Firebase-tools: /bin/bash: node-pre-gyp: command not found error when installing

Created on 26 Dec 2017  路  7Comments  路  Source: firebase/firebase-tools

Version info

Windows 10
Node version: 8.9.1
NPM version: 5.6.0
Firebase Tools Version: 3.16.0

Steps to reproduce

>npm install -g firebase-tools
npm WARN deprecated [email protected]: Use uuid module instead
C:\Users\programmer5000\AppData\Roaming\npm\firebase -> C:\Users\programmer5000\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase

> [email protected] install C:\Users\programmer5000\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

/bin/bash: node-pre-gyp: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\firebase-tools\node_modules\grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

+ [email protected]
added 22 packages, removed 2 packages and updated 17 packages in 259.378s

>firebase serve --only functions,hosting

=== Serving from 'C:\Users\programmer5000\Desktop\firebase-test'...

!  functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
i  hosting: Serving hosting files from: public
+  hosting: Local server: http://localhost:5000

Expected behavior

The functions emulator should start successfully.

Actual behavior

! functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config' and /bin/bash: node-pre-gyp: command not found

Installing @google-cloud/functions-emulator manually

>npm i -g @google-cloud/functions-emulator
C:\Users\programmer5000\AppData\Roaming\npm\functions-emulator -> C:\Users\programmer5000\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\bin\functions
C:\Users\programmer5000\AppData\Roaming\npm\functions -> C:\Users\programmer5000\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\bin\functions

> [email protected] install C:\Users\programmer5000\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

/bin/bash: node-pre-gyp: command not found
npm ERR! file bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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\programmer5000\AppData\Roaming\npm-cache\_logs\2017-12-26T07_55_27_259Z-debug.log

I keep getting this strange /bin/bash: node-pre-gyp: command not found error. How can I solve this?

Most helpful comment

GRPC is a native (aka written in C) extension and it looks like Windows needs extra tools for this. Try running npm install -g node-pre-gyp

All 7 comments

GRPC is a native (aka written in C) extension and it looks like Windows needs extra tools for this. Try running npm install -g node-pre-gyp

Hmm, I still get the same error after running that:

>npm install -g node-pre-gyp
C:\Users\programmer5000\AppData\Roaming\npm\node-pre-gyp -> C:\Users\programmer5000\AppData\Roaming\npm\node_modules\node-pre-gyp\bin\node-pre-gyp
+ [email protected]
updated 1 package in 77.542s
>npm install -g firebase-tools
npm WARN deprecated [email protected]: Use uuid module instead
C:\Users\programer5000\AppData\Roaming\npm\firebase -> C:\Users\programer5000\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase

> [email protected] install C:\Users\programer5000\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

/bin/bash: node-pre-gyp: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\firebase-tools\node_modules\grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

+ [email protected]
added 4 packages and updated 1 package in 173.262s

and when I try to serve, I get the same error

>firebase serve --only functions,hosting

=== Serving from 'C:\Users\philip.hogan\programmer5000\vote-cats-server'...

!  functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'

Hmm.. I see that you're running Bash on Windows. This could make the search path really weird. A lot of times tools for Unix correctly set up the search path for all _future_ shells. As a stupid check, can you open a new window and try again? which node-pre-gyp should return a valid path.

Actually, I have bash on windows installed, but i am not using it.

It looks like Node may be trying to use it. See above where the command was:

/bin/bash: node-pre-gyp: command not found

For sanity's sake, I'd either remove BoW or also install node-pre-gyp there.

And fwiw, take my advice with a grain of salt. We're getting outside my Windows expertise. I prefer the option to install node-pre-gyp in Bash on Windows because it's less invasive if I'm giving bad advice.

Please follow up on GRPC installation issues in grpc/grpc-node#121 as I'm trying to consolidate feedback there.

Was this page helpful?
0 / 5 - 0 ratings