3

I've been trying to fix this error for 2 days now. All I did to get the error was:

  1. create-react-app appname
  2. cd appname
  3. npm install firebase --save (and that's the part that failed to install correctly)

These are the major fixes I've tried:

  • Installed latest version of Python 3 and added it to the windows path variable.
  • Manually downloaded grpc and added it to the project.
  • Updated Node to v10+.

I also tried other minor things not worth mentioning, but it didn't make a difference. None of them worked. I tried with multiple clean react apps so react wasn't the issue either.

C:\Users\Future\Desktop\react-turbo>npm i firebase --save

> grpc@1.10.1 install C:\Users\Future\Desktop\react-turbo\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-win32-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.0.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Future\AppData\Local\Programs\Python\Python36-32\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:149:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\Future\\Desktop\\react-turbo\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Users\\Future\\Desktop\\react-turbo\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown"
gyp ERR! cwd C:\Users\Future\Desktop\react-turbo\node_modules\grpc
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\Future\Desktop\react-turbo\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\Future\Desktop\react-turbo\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Future\Desktop\react-turbo\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:947:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Future\\Desktop\\react-turbo\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\Users\Future\Desktop\react-turbo\node_modules\grpc
node-pre-gyp ERR! node -v v10.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\Future\Desktop\react-turbo\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\Future\Desktop\react-turbo\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown' (1)
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.1 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.10.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Future\AppData\Roaming\npm-cache\_logs\2018-05-07T15_01_00_277Z-debug.log
Virtue
  • 65
  • 2
  • 8

3 Answers3

7

I will recommend that instead of installing node latest version (which might not be well supported by all libraries) try to use the v8.11 stable version.

Then there are couple of actions/trick to handle this thing:

  1. You might be using Windows 10, so try to disable your antivirus and then try again. If on Linux try to use command sudo in start.
  2. Check this as well: unable to install firebase tools cli using windows 10
  3. And this: Error with npm install - a pre-gyp error

Additional Information In reference to learning Firebase these might help you as well:

https://medium.com/quick-code/how-to-integrate-react-redux-and-firebase-in-3-simple-steps-c44804a6af38

https://www.codementor.io/yurio/all-you-need-is-react-firebase-4v7g9p4kf

Nah
  • 1,690
  • 2
  • 26
  • 46
  • The problem was either Node since I had only v10+ versions or the standard Windows Antivirus, maybe even both :-) Disabled the Antivirus and installed Node LTS v8.11 and now it works. You're a life saver, thank you again Muhammad =] I'll never forget this. Now I can continue working on my web app, it's a long way to go from this point. – Virtue May 08 '18 at 10:24
  • Just to update node `v.10` works fine for me now, it seems to be a problem with `v.11+` – P Fuster Jun 23 '19 at 18:28
2

I needed to downgrade node from 10.12 to 8.11

node -v

v10.12.0

npm install -g n
n 8.11.1
mode -v

v8.11.1

ishandutta2007
  • 16,676
  • 16
  • 93
  • 129
0

I don't know if this is relevant, but I was also getting similar errors. I was trying to do install the firebase using expo (as recommended in the docs)

expo install firebase

and this was failing for me. I noticed that the issue was related to my package-lock.json where node-pre-gyp was getting added. Wasted some time, but finally the issue was resolved when I did a npm install (and not expo install) Hope this helps people in the future.

npm install firebase --save

Varesh
  • 1,648
  • 2
  • 14
  • 22