Firebase-tools: Firebase serve return cannot find grpc_node.node module

Created on 26 Aug 2017  Â·  22Comments  Â·  Source: firebase/firebase-tools

Version info

3.9.2

Steps to reproduce

I run:
firebase serve --only functions

Expected behavior


run functions localy

Actual behavior


get error:
âš  functions: Cannot start emulator. Error: Cannot find module '/mnt/c/Users/Fares/AppData/Roaming/npm/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/grpc_node.node'

I'm using Bash on windows, everything run on the right way, but this command give me error.

Most helpful comment

exact same issue

sudo npm install -g grpc --allow-root --unsafe

allowed grpc to install

All 22 comments

+1

exact same issue

sudo npm install -g grpc --allow-root --unsafe

allowed grpc to install

Thanks @stardotbmp

updating firebase-admin to 5.5 seemed to work for me.

+1

This worked form me (I reinstalled firebase tool and update the firebase-functions):-
npm install -g firebase-tools
npm install firebase-functions@latest --save

Still having this issue on OS X High Sierra, Node 8.9.1 via Macports, firebase-tools 3.16.0:

The-Dark-Zone:functions jdolan$ firebase serve --only functions

=== Serving from '/Users/jdolan/Coding/SyncThink/eyesync-cloud-functions'...

âš   functions: Cannot start emulator. Error: Cannot find module '/opt/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node'

What's annoying is that grpc is installed _locally_ in my functions/node_modules folder:

The-Dark-Zone:functions jdolan$ find . -name grpc_node.node
./node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node

I thought a clever symlink could get me past this:

cd /opt/local/lib/node_modules/firebase_tools/node_modules
sudo rm -rf grpc
sudo ln -s ~/path/to/functions/node_modules/grpc

But alas:

The-Dark-Zone:functions jdolan$ firebase serve --only functions

=== Serving from '/Users/jdolan/Coding/SyncThink/eyesync-cloud-functions'...

Error: An unexpected error has occurred.

Turns out my error was permissions related. Symlink, or globally installing grpc as described above, is a valid workaround.

Hey everyone, I was having the same issue and I thought I would share how I fixed it. The main reason why it was throwing an error was the folder,node_modules/firebase-tools/node_modules/grpc/src/node, was missing. Running npm install -g firebase-tools, and even removing it before hand didn't work. that /node folder in grpc was still missing.

I followed @stardotbmp suggestion and installed grpc as a global package by running their command. However, firebase wasn't recognising it still. I went into the global firebase-tools instance, removed the grpc package, and replaced it with a symbolic link to the global grpc package.

The commands should be as follows:

sudo npm install -g firebase-tools

sudo npm install -g grpc --allow-root --unsafe

cd /path/to/global/node_modules/firebase-tools/node_modules

sudo rm -rf grpc

ln -s /path/to/node_modules/grpc/ /path/to/node_modules/firebase-tools/node_modules/grpc

cd /to/your/project/functions

firebase serve --only functions

@CanadianEngineer thanks, it worked for me

yarn global add grpc works for me.

My previous error message was:

! functions: Cannot start emulator. Error: Cannot find module 'C:\Users\[User]\AppData\Local\Yarn\config\global\node_modules\grpc\src\node\extension_binary\node-v48-win32-x64-unknown\grpc_node.node'
and I use nvm @ https://github.com/coreybutler/nvm-windows and installed node 6.11.5

None of these solutions seem to work - I have never really managed to get Firebase serve locally working..
Maybe they should switch to local docker?

Please direct all feedback regarding grpc installation to grpc/grpc-node#121 thanks!

@CanadianEngineer Thank you, it worked for me.

henrylearn2rock's comment above, regarding using yarn global add grpc did the trick for me!

What finally worked for me was yarn add grpc in my functions directory. Every other solution above failed.

firebase-tools no longer requires grpc, upgrading to the newest version will work without any additional workarounds.

Delete functions/node_modules -> yarn install

It worked and idk y.

cd functions
npm rebuild should do

npm install firebase-functions@latest --save;
npm install firebase-admin@latest --save

Inside the functions folder fixed this for me.

I just removed node_modules and install again:

rm -rf node_nodules/
npm install

run npm install with sudo solved the problem for me

Was this page helpful?
0 / 5 - 0 ratings