27

I'm getting a mass of error messages when I try to install node_modules in my project. I've previously installed it successfully, but I'm not sure what I've done wrong to cause all these error messages to be generated now.

Any help to decipher what they mean would be great. Just before this, I did the following install of grpc, which installed v1.14.1:

$ npm install -g grpc@latest

grpc@1.14.1 install /usr/local/lib/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download 
[grpc] Success: "/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" is installed via remote
+ grpc@1.14.1
added 85 packages from 48 contributors in 6.344s

so it's curious why node is trying to use v1.10.1 in the following messages:

$ npm i

> fsevents@1.2.4 install /path/to/app/node_modules/fsevents
> node install

[fsevents] Success: "/path/to/app/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> grpc@1.10.1 install /path/to/app/node_modules/@firebase/firestore/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-darwin-x64-unknown.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.9.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.9.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file 
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
sed: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /path/to/app/node_modules/@firebase/firestore/node_modules/grpc
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/10.9.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/path/to/app/node_modules/@firebase/firestore/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:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/10.9.0/bin/node" "/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /path/to/app/node_modules/@firebase/firestore/node_modules/grpc
node-pre-gyp ERR! node -v v10.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/Cellar/node/10.9.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.oexec install script
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.oinstall script
error: error reading '../deps/grpc/src/core/lib/channel/channel_args.cc'
1 error generated.
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Darwin 17.7.0l: info lifecycle grpc@1.10.1~install: Failed to exec install script
gyp ERR! command "/usr/local/Cellar/node/10.9.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/path/to/app/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /path/to/app/node_modules/@firebase/firestore/node_modules/grpc
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
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!     /Users/myfolder/.npm/_logs/2018-09-03T16_54_49_177Z-debug.log
AlphaBeta
  • 1,023
  • 1
  • 9
  • 18
  • Does your project have "node-sass" in the package.json? I do and have the same error. Try `npm i node-sass` see if that causes it. – mesqueeb Sep 04 '18 at 12:30
  • No, there's no mention of sass in package.json or config.xml. I guess it just came with node. – AlphaBeta Sep 04 '18 at 13:22

10 Answers10

41

It took a while to find, but the solution that worked for me was:

  1. Delete the node_modules/grpc folder
  2. Delete the package-lock.json file in the project root folder
  3. npm rebuild node-sass

The ionic serve and build commands now work for ios.

Edit (2018-09-07):

Although the above steps worked temporarily, the grpc 1.10.1 problem came back later. After much more investigation and thanks to a prompt from @murgatroid99, I found the problem was being caused by an old version of firestore in the firebase plugin, which was referencing grpc v1.10.1 in it's package.json.

After I updated firebase to the latest version with:

npm i firebase@latest

it reporting using v1.13.1 and the problem went away.

I hope that helps anyone having the same problem.

AlphaBeta
  • 1,023
  • 1
  • 9
  • 18
8

What is your node version? You can check it by "node -v", mine was v10.9.0 and I had this error, but when I downgrade to v8.11.4 downloading from this site "https://nodejs.org/en/" and made npm update - it works.

Mr. Pear
  • 167
  • 1
  • 1
  • 11
  • It's node-sass@4.9.3, but a curious thing is that the messages seems to be using grpc@1.10.1, even though I have v1.14.1 installed. I don't know where it got v1.10.1 from. Also, I've tried going to https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gz in my browser and it gives an access denied message, so would that be Google not setting their permissions properly? – AlphaBeta Sep 04 '18 at 13:24
  • You save my life – Yudhistira Bayu Oct 24 '18 at 04:32
6

The problem here is that gRPC 1.10 is a bit old and does not support Node 10. You can resolve this by either using a newer version of gRPC or an older version of Node.

The error message in the question indicates that the failure occurs when installing gRPC as a dependency of @firebase/firestore. You may need to upgrade your dependency on that package to get a newer version of gRPC.

murgatroid99
  • 19,007
  • 10
  • 60
  • 95
  • Yes, it's certainly old and I have v1.14.1 installed and it's mentioned everywhere I can see, whereas I can't find any mention of 1.10.1 anywhere. So I'm still wondering where npm is getting the 1.10.1 version from. Any ideas where it's getting v1.10.1 from would be great. – AlphaBeta Sep 06 '18 at 12:04
  • I added some information in my answer about where that version is coming from – murgatroid99 Sep 06 '18 at 14:46
  • I've tried using npm i @firebase@latest to update it, but I get the message 'Invalid package name "@firebase": name can only contain URL-friendly characters'. What is the correct way to update this package? – AlphaBeta Sep 07 '18 at 09:55
  • I've also noticed a curious thing too. I don't use firestore in my app, so I have no idea why it's been included, but when I try updating/deleting other packages e.g. npm uninstall cordova-plugin-fcm, the firestore folder under node_modules/@firestore briefly appears, then disappears. Any idea why that might happen? – AlphaBeta Sep 07 '18 at 10:00
  • The package name isn't `@firebase`, it's `@firebase/firestore`. – murgatroid99 Sep 07 '18 at 15:06
  • Just faced this issue as well. Turns out gRPC v1.19.0 isn't compatible with Node v12.0.0 so I downgraded it to v10.15.3 and it started working. – LuisCien Apr 27 '19 at 02:34
2

I was gone through same problem solved after lot efforts. It is because of npm version is not compatible with gprc version. So we need to update the npm.

1 - npm update
2 - npm install 

This solve my issue. Thank you

Vishal Chavan
  • 334
  • 3
  • 3
  • 1
    `npm update` does not update npm BUT ALL PACKAGES. You should be sure that this is what you want before doing so. https://docs.npmjs.com/cli/v6/commands/npm-update – Tim Rasim Feb 19 '21 at 09:22
1

If you use windows. Try start command as administrator.

0

I had a same problem with grpc@1.23.1 , I put in package.json "grpc": "~1.22.2" and it solved the problem. Seems like there is a problem with compiling grpc@1.21.0 and @1.23.1 but on @1.22 it works fine. No

0

I installed windows-build-tools and did an update of the firebase. It worked

Niranjan
  • 77
  • 9
0

Degrade your node to 10.0.0 and then add the dependency for "grpc": "~1.22.2" with this exact version. And, then do a npm i with command prompt as administrator.

0

Follow the steps given below to resolve this issue,

Solution 1:

  • Delete the node_modules folder.

  • Install firebase module by the following command

    npm install firebase --force
    
  • Install the remaining modules.

    npm install
    

Solution 2:

Add the following lines to the package.json file

"dependencies": {
    "firebase": "^5.0.2"
    ...
},
"resolutions": {
    "grpc": "^1.12.0"
}
Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
-3

I am having a similar issue. Tried every which thing but no relief :(

~/Documents/dev/node/fb: npm install -save firebase

grpc@1.20.3 install /Users/hbhagwat001/Documents/dev/node/fb/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Pre-built binaries not installable for grpc@1.20.3 and node@12.6.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error self signed certificate in certificate chain gyp ERR! configure error gyp ERR! stack Error: Command failed: /anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", line 1 gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];

hpep
  • 37
  • 3