Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILD FAILED #75

Open
zhuanglong opened this issue Feb 8, 2017 · 10 comments
Open

BUILD FAILED #75

zhuanglong opened this issue Feb 8, 2017 · 10 comments

Comments

@zhuanglong
Copy link

baidushurufa_2017-2-8_17-34-22

@gongzai
Copy link

gongzai commented Feb 10, 2017

同问 编译时也遇到了这个问题

@zelongg
Copy link

zelongg commented Feb 20, 2017

Also encountered the same issue.
commit: efc5c76

:app:bundleDebugJsAndAssets
bundle: Created ReactPackager
uncaught error Error: SyntaxError: /Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/react-native-viewpager/ViewPager.js: Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (211:40)
  209 |   },
  210 | 
> 211 |   _getPage(pageIdx: number, loop = false: boolean) {
      |                                         ^
  212 |     var dataSource = this.props.dataSource;
  213 |     var pageID = dataSource.pageIdentities[pageIdx];
  214 |     return (
    at Parser.pp$5.raise (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:4333:13)
    at Parser.parseMaybeDefault (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:5635:14)
    at Parser.pp$2.parseBindingList (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:3037:22)
    at Parser.pp$3.parseMethod (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:4053:22)
    at Parser.pp$3.parseObjPropValue (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:3976:10)
    at Parser.parseObjPropValue (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:5604:13)
    at Parser.pp$3.parseObj (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:3950:10)
    at Parser.pp$3.parseExprAtom (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:3639:19)
    at Parser.parseExprAtom (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:6591:22)
    at Parser.pp$3.parseExprSubscripts (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/babylon/lib/index.js:3414:19)
See logs /var/folders/gf/hgd91n6x5v73ct9dvhr379500000gn/T/react-packager.log
    at SocketClient._handleMessage (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/react-native/packager/react-packager/src/SocketInterface/SocketClient.js:139:23)
    at BunserBuf.<anonymous> (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/react-native/packager/react-packager/src/SocketInterface/SocketClient.js:53:42)
    at emitOne (events.js:96:13)
    at BunserBuf.emit (events.js:188:7)
    at BunserBuf.process (/Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/bser/index.js:292:10)
    at /Users/gongzelong/Android/demo/ZhiHuDaily-React-Native/node_modules/bser/index.js:247:12
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
:app:bundleDebugJsAndAssets FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleDebugJsAndAssets'.
> Process 'command 'react-native'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 3.71 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

@zelongg
Copy link

zelongg commented Feb 20, 2017

My node.js version is v6.9.1
➜ ZhiHuDaily-React-Native git:(master) node --version
v6.9.1
➜ ZhiHuDaily-React-Native git:(master)

@zelongg
Copy link

zelongg commented Feb 20, 2017

I change the below
_getPage(pageIdx: number, loop = false: boolean) {
to

_getPage(pageIdx: number, loop: boolean = false) {

It still doesn't work.

Oh, it make the build error disappear. But when opening the android app, I got the below.

image

@zelongg
Copy link

zelongg commented Feb 20, 2017

Update:

I tried to delete node_modules and install everything again.
And it worked.
image

Here is my reference.
xotahal/react-native-material-ui#26

@zelongg
Copy link

zelongg commented Feb 20, 2017

Plus, I also add the lines in 'ZhiHuDaily-React-Native/android/build.gradle'.

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

facebook/react-native#10140
http://facebook.github.io/react-native/docs/integration-with-existing-apps.html

@ScottYang36
Copy link

Does anyone know how to handle it?
caught error Error: SyntaxError: C:/Code/MyProject/ZhiHuDaily-React-Native-master/ZhiHuDaily-React-Native-master/node_modules/react-native-viewpager/ViewPager.js: Type annotations must come before default assignments, e.g. instead of age = 25: number use age: number = 25 (211:40)
209 | },
210 |
> 211 | _getPage(pageIdx: number, loop = false: boolean) {
| ^
212 | var dataSource = this.props.dataSource;
213 | var pageID = dataSource.pageIdentities[pageIdx];
214 | return (
at Parser.pp$5.raise (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:4454:13)
at Parser.parseMaybeDefault (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:6284:14)
at Parser.pp$2.parseBindingList (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:3121:22)
at Parser.pp$3.parseMethod (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:4178:22)
at Parser.pp$3.parseObjectMethod (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:4097:10)
at Parser.pp$3.parseObjPropValue (C:\Code\MyProject\ZhiHuDaily-React-Native-master\ZhiHuDaily-React-Native-master\node_modules\babylon\lib\index.js:4140:19)

@ScottYang36
Copy link

My dev-os is Win-10, but seems like this project need dependency - fsevents which is on OSX.

so after "npm install" will post below warnings
"npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})"

@ScottYang36
Copy link

modify:
_getPage(pageIdx: number, loop = false: boolean) {
to
_getPage(pageIdx: number, loop: boolean = false) {

build failed solved.

@gongzelong0718
Copy link

Plz ignore this. Update with personal github account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants