question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm install -g firebase-tools fails but npm install -g firebase-tools@v7.7.0 works

See original GitHub issue

A 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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
bkendallcommented, Nov 19, 2019

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 includes protobufjs. 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 as root (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 as root with the --unsafe-perm flag (preferred, generally), or do npm 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!

4reactions
lc-chrisbartoncommented, Nov 19, 2019

Thanks that worked npm install --unsafe-perm -g firebase-tools

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found