JaneaSystems / nodejs-mobile

Full-fledged Node.js on Android and iOS
https://code.janeasystems.com/nodejs-mobile
Other
2.58k stars 182 forks source link

Breaks when installing firebase into React Native nodejs-assets/nodejs-project/ #213

Open Matthcw opened 5 years ago

Matthcw commented 5 years ago

Project: nodejs-mobile-react-native Version: 1.14.1 Mobile device: N/A Mobile OS and version: N/A Development Node.js: v8.10.0 Development platform: Linux mpsm-lt 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I'm using nodejs-mobile-react-native in react native, and it works fine.

But when I want to npm install firebase --save in the nodejs-assets/nodejs-project/ I get the following error:

> Task :nodejs-mobile-react-native:BuildNpmModulesarm64-v8a FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nodejs-mobile-react-native:BuildNpmModulesarm64-v8a'.
> Process 'command 'npm'' finished with non-zero exit value 1

log:

...
npm verb lifecycle grpc@1.20.3~install: unsafe-perm in lifecycle false
npm verb lifecycle grpc@1.20.3~install: PATH: /usr/share/npm/bin/node-gyp-bin:/home/mpsm/Documents/remove/SocialSauceNative/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/@firebase/firestore/node_modules/grpc/node_modules/.bin:/home/mpsm/Documents/remove/SocialSauceNative/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/@firebase/firestore/node_modules/.bin:/home/mpsm/Documents/remove/SocialSauceNative/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/.bin:/home/mpsm/Documents/remove/SocialSauceNative/android/../nodejs-assets/nodejs-project/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
npm verb lifecycle grpc@1.20.3~install: CWD: /home/mpsm/Documents/remove/SocialSauceNative/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/@firebase/firestore/node_modules/grpc
npm info lifecycle grpc@1.20.3~install: Failed to exec install script
npm verb stack Error: grpc@1.20.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:925:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb pkgid grpc@1.20.3
npm verb cwd /home/mpsm/Documents/remove/SocialSauceNative/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project
npm ERR! Linux 4.15.0-54-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "--verbose" "rebuild" "--build-from-source"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! grpc@1.20.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc@1.20.3 install script 'node-pre-gyp install --fallback-to-build --library=static_library'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the grpc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs grpc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls grpc
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]
jaimecbernardo commented 5 years ago

Hi @Matthcw , looks like an error build grpc as a native module. Are you able to share the complete logs in a https://gist.github.com , for example? This log is missing the actual build errors from compilation. One likely suspect is that you might need to update to node 10 in the development machine so that nodejs-mobile-gyp has all the variables it needs.

Matthcw commented 5 years ago

Hi @jaimecbernardo you can find the logs here: https://gist.github.com/Matthcw/b3e812ecbdbcde58838bbb12e86c2a77

jaimecbernardo commented 5 years ago

Hi @Matthcw ,

Couldn't find anything useful in the logs, since it doesn't seem to be outputting compilor errors in your case.

I've tried adding firebase 6.3.0 and got it to build by making the change described here to grpc: https://github.com/JaneaSystems/nodejs-mobile-module-compat/issues/2#issuecomment-489628233

In my case, I got this error in the output:

error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
make: *** [Release/obj.target/grpc_node/ext/byte_buffer.o] Error 1

Please give it a try. I'd also advise updating the development node to version 10 in case this doesn't work.