firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 936 forks source link

Firebase serve return cannot find grpc_node.node module #442

Closed Faares closed 6 years ago

Faares commented 7 years ago

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.

jenishngl commented 7 years ago

+1

jsdbroughton commented 7 years ago

exact same issue

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

allowed grpc to install

chiragpurohit71085 commented 6 years ago

Thanks @stardotbmp

tbass134 commented 6 years ago

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

gastzars commented 6 years ago

+1

factedu commented 6 years ago

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

jdolan commented 6 years ago

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.
jdolan commented 6 years ago

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

CanadianEngineer commented 6 years ago

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

tevenFr commented 6 years ago

@CanadianEngineer thanks, it worked for me

henrylearn2rock commented 6 years ago

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

grantkemp commented 6 years ago

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?

mbleigh commented 6 years ago

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

simonthesupplier commented 6 years ago

@CanadianEngineer Thank you, it worked for me.

stevejboyer commented 6 years ago

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

phatmann commented 6 years ago

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

laurenzlong commented 6 years ago

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

sianlasaga commented 6 years ago

Delete functions/node_modules -> yarn install

It worked and idk y.

satyaavasarala commented 6 years ago

cd functions npm rebuild should do

ggaabe commented 6 years ago
npm install firebase-functions@latest --save;
npm install firebase-admin@latest --save

Inside the functions folder fixed this for me.

jhoansebastianlara commented 6 years ago

I just removed node_modules and install again:

rm -rf node_nodules/ npm install

lfernando-silva commented 5 years ago

run npm install with sudo solved the problem for me