npm install -g firebase-tools fails but npm install -g firebase-tools@v7.7.0 works
See original GitHub issueA few hours ago running npm install -g firebase-tools
in our CI system started failing. We pinned to v7.7.0 to fix the issue.
Does not work
npm install -g firebase-tools
Works
npm install -g firebase-tools@v7.7.0 works
[REQUIRED] Environment info
Docker Engine Version: 18.09.6
Kernel Version: Linux 95319c6db09e 4.15.0-1043-aws #45-Ubuntu SMP Mon Jun 24 14:07:03 UTC 2019 x86_64 Linux
Starting container google/cloud-sdk
image is cached as google/cloud-sdk, but refreshing...
latest: Pulling from google/cloud-sdk
Digest: sha256:1323aeb05506dada2034d94e1bcd3504ca6e76263e68db1fac78d07fd22cc259
Status: Image is up to date for google/cloud-sdk:latest
using image google/cloud-sdk@sha256:1323aeb05506dada2034d94e1bcd3504ca6e76263e68db1fac78d07fd22cc259
[REQUIRED] Test case
Run npm install -g firebase-tools
in a google/cloud-sdk container
[REQUIRED] Steps to reproduce
npm install -g firebase-tools
[REQUIRED] Expected behavior
Tools install
[REQUIRED] Actual behavior
/root/.nvm/versions/node/v12.13.0/bin/firebase -> /root/.nvm/versions/node/v12.13.0/lib/node_modules/firebase-tools/lib/bin/firebase.js
> protobufjs@6.8.8 postinstall /root/.nvm/versions/node/v12.13.0/lib/node_modules/firebase-tools/node_modules/protobufjs
> node scripts/postinstall
sh: 1: node: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/firebase-tools/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! protobufjs@6.8.8 postinstall: `node scripts/postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the protobufjs@6.8.8 postinstall script
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
npm install -g firebase-tools failed - Stack Overflow
I've checked the Node and the npm. Node: v14.15.1 npm: 7.18.1. Seems good to install according to the Firebase CLI reference. But the...
Read more >Firebase CLI reference
npm install -g firebase-tools. This command enables the globally available firebase command. Note: If the npm install -g firebase-tools command fails, ...
Read more >firebase-tools - npm
Setup a new Firebase project in the current directory. This command will create a firebase.
Read more >Encountering errors while trying to install Firebase - Reddit
I keep getting an error while trying to install it using command: "npm install - g firebase-tools".. - npm version: 8.15.0.
Read more >Intermittent failures: firebase.tools - Exited with code exit status 7
While we investigate in this issue I would recommend using a workaround to install using npm and more details on the link below....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have… news. First, I can replicate this. Yaaaayyyy…
Second, I can put my finger on the fact that we now include
@google-cloud/pubsub
as a dependency for the emulators, which includesprotobufjs
.protobufjs
was previously only a dev dependency, so it never would have run it’s postinstall script in the container like this.When running postinstall scripts,
npm
attempts to not run asroot
(for reasons). When running as root,npm
will try to prevent the user from doing things that could have bad consequences. There is a parameter named unsafe-perm that can disable this.Either run the
npm install -g
in the container asroot
with the--unsafe-perm
flag (preferred, generally), or donpm config set unsafe-perm true
somewhere before (which turns off this behavior everywhere, which wouldn’t be desirable outside of a container, probably).I hope that answers your question!
Thanks that worked
npm install --unsafe-perm -g firebase-tools