Hi there,
Refer to issue #200
I try reinstall grpc but still getting same error
After install grpc it show success but grpc_node.node is installed via remote, like this
[grpc] Success: "/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64/grpc_node.node" is installed via remote
When run firebase deploy --only functions it it showing
functions: Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/grpc_node.node'
I checked in directory was nothing inside
/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary
Please give some advice, thank you in advance.
Similar issue - I've found various other threads on here related to this, but none of them seem to work. For me, somehow not only am I getting the above error:
Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/grpc_node.node'
But for me when I use "sudo npm install -g grpc" I get the following error:
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.7.0/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/michaelrhanscom/.node-gyp/8.9.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/grpc/.node-gyp"
Where the last 2 gyp warnings continue to populate on the screen over and over until I terminate the process. I tried to use "sudo npm install -g grpc --allow-root --unsafe" which seemed to work, but when I go back through the various folders, I still get down to '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node" and then beyond that the folder for "extension_binary" doesn't even exist. Additionally, for the path within the above error, within the node_modules/grpc, the folder .node_gyp also doesn't exist. Help?
I was able to install it using yarn instead.
sudo yarn add firebase-tools
Hi,
I am facing this error in windows. When i type firebase experimental:functions:shell , i get this error -
! functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/confi
g'
I am able to run the function on server when i deploy . Please help, thanks
Everyone who is using sudo in your install scripts: this is not the recommended best practice
Consider fixing NPM permissions
@vik17ag The emulator is an optional dependency of firebase-tools (since only Cloud Functions needs that high a version of Node). I'd try the following:
npm install -g firebase-toolsnpm install -g @google-cloud/functions-emulatorAlso, as a side comment to others: grpc is a native node binary. Native binaries often only work with the version of Node for which they were compiled. If you are using nvm please make sure you've installed grpc on the same version of Node.
Thanks for reply. I tried reinstalling firebase tools & install emulator as mentioned by you but got the below log error
$ npm install -g @google-cloud/functions-emulator
C:\Users\vivek-pc\AppData\Roamingnpmfunctions-emulator -> C:\Users\vivek-pc\AppData\Roamingnpmnode_modules\@google-cloudfunctions-emulator\binfunctions
npm ERR! path C:\Users\vivek-pc\AppData\Roamingnpmfunctions
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall open
npm ERR! EISDIR: illegal operation on a directory, open 'C:\Users\vivek-pc\AppData\Roamingnpmfunctions'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vivek-pc\AppData\Roamingnpm-cache_logs\2017-11-22T05_53_40_280Z-debug.log
Interesting. I wonder if there's a problem with an old version of the library. Mind copying the state from that debug log so I can see what was happening when NPM tried to treat that directory like a file?
@inlined I have a similar issue.
functions vignesh.ravichandran$ firebase experimental:functions:shell
âš functions: Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64/grpc_node.node'
When i looked for the file, i found a directory node-v48-darwin-x64 under extension_binary. It looks like version mismatch. Any advice? Thanks.
I had the same issue when I ran on my Mac OS X High Sierra (not clear if this happens on Windows or Linux platforms)
sudo npm install -g firebase-tools
Error/Warning:
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
Here is what I did to avoid this:
sudo mkdir -p /usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.1/
This creates an empty directory with the path specified then rerun the following:
sudo npm install -g firebase-tools
I hope this helps.
@vguhesan You're continuing to dig yourself into the "sudo" rabbit hole, which is a bit dangerous. Any exploit of a Node tool on your system could lead to a full compromise of your development machine. See my linked instructions above for fixing node permissions.
@vr001 The v48 and v57 are likely referring to different V8 engines. I'd run npm uninstall -g grpc, use nvm to switch to the Node version you want, and run npm install -g grpc. I'm honestly not sure if the npm uninstall command needs to be run with nvm set to the newer version of Node.
@vik17ag Still waiting on your response specifically. The contents of C:\Users\vivek-pc\AppData\Roaming\npm-cache_logs\2017-11-22T05_53_40_280Z-debug.log would help me understand why there was a directory that the installer expected to be a file.
Hi,
Sorry for delay. Log file attached.
2017-11-28T06_10_07_979Z-debug.log
Last week I try make ln link to the location that grpc installed, it work.
/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64/grpc_node.node
hope this help.
@vik17ag From your debug logs it looks like this is at the final step where node "binaries" are created (by linking them back to their real scripts). I might guess that a code structure change of @google-cloud/functions-emulator previously linked against a directory and now it links against a file.
I would first try:
npm uninstall -g @google-cloud/functions-emulator
dir C:\Users\vivek-pc\AppData\Roaming\npm\functions
If the dir command shows that "functions" no longer exists, then you should be able to successfully run npm install -g @google-cloud/functions-emulator If the directory _did_ still exist after you uninstalled your old version of the emulator, we'll need to look into that directory and try to guess what node module has a conflicting name.
I ran the uninstall command, but function directory exists and has following structure
04/15/2017 12:17 PM
Can i try uninstalling npm or firebase -tools and re-installing them?
LOL. I think I would bet $1 that you initialized a firebase project in C:\Users\vivek-pc\AppData\Roaming\npm.
What is the contents of C:\Users\vivek-pc\AppData\Roaming\npm\package.json?
Oh Gosh, I think i did.
package.json contents -
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"firebase-admin": "~4.1.2",
"firebase-functions": "^0.5"
},
"private": true
}
Pls suggest what do i do?
It's totally fine to just delete the directory. You probably also have an extra "firebase.json" and ".firebaserc" one level higher. You might have other junk sibling directories like "public" that are a default Firebase Hosting directory.
This fixed it for me: https://github.com/firebase/firebase-admin-node/issues/121#issuecomment-339453329
I have this same issue. I've followed various steps referenced in this thread, but cannot get the emulator to start.
functions: Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node'
@elihorne Please try running npm install -g grpc. If that fails to install you should have your answer.
@elihorne I think I fixed the issue described in your post by deleting the node_modules folder followed by running npm install.
Same problem here. installed npm install -g grpc without error
âš functions: Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v59-darwin-x64-unknown/grpc_node.node'
I get this error :
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
Has google removed the old version..
https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v59-darwin-x64.tar.gz - looks like its giving a 403 error?
AccessDenied
Anonymous users does not have storage.objects.get access to grpc-precompiled-binaries/node/grpc/v1.6.6/node-v59-darwin-x64.tar.gz.
I also had this problem, but i could fix it. The error looked like the following:
functions: Cannot start emulator. Error: Cannot find module '/usr/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node'
so i looked up which version corresponds to 'node-v57':
Node Versions
I installed the corresponding version with nvm
nvm install 8.9.3
then i uninstalled the firebase-tools global package and installed it again (yes, sudo, i know ....):
sudo npm uninstall -g firebase-tools
sudo npm --unsafe-perm install -g firebase-tools
I used the --unsafe-perm flag, because when not doing so it ended in an endless loop of the following error message (but i actually don't know what the flag exactly is for, but it's needed, otherwise the emulator wouldn't start):
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.3"
After these commands the emulator was able to start. My guess is that this error occurs when firebase-tools (or the functions-emulator) are installed with the "wrong" node version.
Maybe this helps someone.
Having the same issue. Did not try to replicate using @lufonius work around.
Facing same issue:
! functions: Cannot start emulator. Error: Cannot find module\c:\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node'
If you need to use sudo to run any node or npm commands, if you have needed to use sudo in the past for any node or npm command, or if you needed to use sudo to install Node.js and npm, then this could indicate a problem with your Node.js installation.
To remedy:
npm) from your system.Install your desired version of Node.js. If you're using the Emulator, install v6.11.5
nvm install v6.11.5
nvm alias default v6.11.5
nvm use v6.11.5
npm install -g npm
_Now_ you may install Firebase tools (and the emulator), _after_ switching to the right version of Node.js.
npm install -g firebase-tools
If you get any module version mismatch errors, it's because you installed an npm module with native dependencies (in this case, the emulator) with one version of Node.js, and then you tried to run it with a different version of Node. It has to be installed and run with the same version of Node.js. Uninstall and reinstall with the right version of Node.js.
If you're still having problems installing grpc, please open an issue on the grpc repo with details of your system environment.
@jmdobry is right af. This really works when it’s configured correctly. You can try it out in a vm or a Docker container to see for yourself on a clean system. I’ve made it work in my dev environment without a hassle, see this file to see how the Node is being installed in this container.
There’s also a little gotcha in @jmdobry ‘s solution: yarn is not managed by nvm. It might interfere with nvm in many, many ways.
I just reinstall npm install -g firebase-tools. Now its working..
Step 1: npm uninstall -g firebase-tools
Step 2: npm install -g firebase-tools
Running Windows 10, admin command prompt, I'm running "firebase init" and it is failing with the following output:
? Do you want to install dependencies with npm now? Yes
...other output here...and then the following failure...
[email protected] install C:DevelopmentfbToolsfunctionsnode_modulesfirebase-adminnode_modulesgrpc
node-pre-gyp install --fallback-to-build --library=static_librarynode-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
And then the compile fails because I don't have all the build tools installed. But I don't want to have to compile from source code...why is the fetch of the pre-built binaries failing?
This is after having tried to resolve the problem re-installing firebase-tools as indicated by @katherdx
This worked pretty well for me the error I was getting was:
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"
So based on the link below I added npx to the end of the command and then the install worked.
https://www.npmjs.com/package/npx
sudo npm install -g firebase-tools npx
OS X 10.12.x
sudo rm -rf /usr/local/lib/node_modules
Install Stable Node.js from https://nodejs.org/dist/v8.9.4/node-v8.9.4.pkg
sudo npm install --unsafe-perm -g firebase-tools
firebase init
The key for me was to completely delete node_modules directory from /usr/local/lib, and reinstall firebase-tools using the --unsafe-perm command line option. No other suggestion worked.
Hope this helps.
Please do not recommend using sudo and --unsafe-perm. This would allow a malicious node module to compromise your whole machine
I would agree that you should not use --unsafe-perm in a production environment but to get things going on a dev box it's more than acceptable. I need to be able to develop the product, I can worry about hardening my prod environment when it comes to actually deployment.
This is what I get, anyone solved this issue?
functions: Cannot start emulator. Error: Cannot find module './acceleratedmobilepageurl/v1'
(node:16724) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
at C:\....\node_modules\firebase-tools\lib\command.js:82:34
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rej
ection id: 2)
(node:16724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Most helpful comment
I had the same issue when I ran on my Mac OS X High Sierra (not clear if this happens on Windows or Linux platforms)
sudo npm install -g firebase-toolsError/Warning:
Here is what I did to avoid this:
sudo mkdir -p /usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.1/This creates an empty directory with the path specified then rerun the following:
sudo npm install -g firebase-toolsI hope this helps.
MyThinkPond | vguhesan