EACCESS with `npm install -g firebase-tools`

Started happening few mins ago, reported it to @w9jds but suspecting something changed on github’s docker.

Below is a copy of details mentioned at https://github.com/w9jds/firebase-action/issues/46#issue-642533415

2020-06-21T09:58:11.0318028Z Step 10/14 : RUN npm install -g firebase-tools
2020-06-21T09:58:11.0421728Z  ---> Running in 50ade17f217f
2020-06-21T09:58:12.9119224Z �[91mnpm�[0m�[91m WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
2020-06-21T09:58:26.9619471Z �[0m/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
2020-06-21T09:58:27.0361948Z 
2020-06-21T09:58:27.0362975Z > protobufjs@6.9.0 postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/protobufjs
2020-06-21T09:58:27.0363184Z > node scripts/postinstall
2020-06-21T09:58:27.0363272Z 
2020-06-21T09:58:27.2149187Z 
2020-06-21T09:58:27.2149704Z > storage-engine@3.0.7 postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine
2020-06-21T09:58:27.2149889Z > node ./compatibility/detect.js
2020-06-21T09:58:27.2149986Z 
2020-06-21T09:58:27.2864720Z �[91mfs.js:114
2020-06-21T09:58:27.2865857Z     throw err;
2020-06-21T09:58:27.2866847Z     ^
2020-06-21T09:58:27.2866917Z 
2020-06-21T09:58:27.2867087Z Error: EACCES: permission denied, open '/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/index.js'
2020-06-21T09:58:27.2867267Z     at Object.openSync (fs.js:443:3)
2020-06-21T09:58:27.2867416Z     at Object.writeFileSync (fs.js:1194:35)
2020-06-21T09:58:27.2867579Z     at /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:35:15
2020-06-21T09:58:27.2867782Z     at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:45:3)
2020-06-21T09:58:27.2867958Z     at Module._compile (internal/modules/cjs/loader.js:778:30)
2020-06-21T09:58:27.2868152Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
2020-06-21T09:58:27.2868314Z     at Module.load (internal/modules/cjs/loader.js:653:32)
2020-06-21T09:58:27.2868465Z     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2020-06-21T09:58:27.2868618Z     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2020-06-21T09:58:27.2868773Z     at Module.require (internal/modules/cjs/loader.js:692:17)
2020-06-21T09:58:28.1712904Z �[0m�[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents):
2020-06-21T09:58:28.1714351Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2020-06-21T09:58:28.1714837Z �[0m�[91m
2020-06-21T09:58:28.1715436Z �[0m�[91mnpm ERR! code�[0m�[91m ELIFECYCLE
2020-06-21T09:58:28.1716647Z �[0m�[91mnpm ERR! errno 1
2020-06-21T09:58:28.1717248Z �[0m�[91mnpm ERR!�[0m�[91m storage-engine@3.0.7 postinstall: `node ./compatibility/detect.js`
2020-06-21T09:58:28.1717626Z npm ERR! Exit status 1
2020-06-21T09:58:28.1717925Z �[0m�[91mnpm ERR!�[0m�[91m 
2020-06-21T09:58:28.1718244Z npm ERR! Failed at the storage-engine@3.0.7 postinstall script.
2020-06-21T09:58:28.1718608Z npm ERR!�[0m�[91m This is probably not a problem with npm. There is likely additional logging output above.
2020-06-21T09:58:28.1718939Z �[0m�[91m
2020-06-21T09:58:28.1719250Z �[0m�[91mnpm ERR!�[0m�[91m A complete log of this run can be found in:
2020-06-21T09:58:28.1719598Z npm ERR!     /root/.npm/_logs/2020-06-21T09_58_27_941Z-debug.log
2020-06-21T09:58:28.7264460Z The command '/bin/sh -c npm install -g firebase-tools' returned a non-zero code: 1
2020-06-21T09:58:28.7264706Z �[0m
2020-06-21T09:58:28.7281969Z ##[warning]Docker build failed with exit code 1, back off 1.208 seconds before retry.
2020-06-21T09:58:29.9374851Z ##[command]/usr/bin/docker build -t 3888d3:c8ac01ba3f3548cdabe384e4965f3ee8 -f "/home/runner/work/_actions/w9jds/firebase-action/master/Dockerfile" "/home/runner/work/_actions/w9jds/firebase-action/master"
2020-06-21T09:58:29.9747718Z Sending build context to Docker daemon  10.75kB

Facing the same issue all of a sudden. Unable to deploy anything. :frowning_face:

This was actually caused by firebase-tools due to how docker works (It pulls and installs latest tool version each time it runs) it pulled a bad version, there are issues opened to fix it. However, I have pushed v1.4.0 which addresses the issue and uses a workaround to get it to work. If you are pointing to master, the build should just work now if you re-run it. Otherwise, point your action to the latest release and you should be good.

Note, it was reproducible with a local version of docker as well.

2 Likes

I can confirm v1.4.0 worked for me. Thanks for the quick update! :slight_smile:

Edit: I tried master again and can confirm it works!

@anandchakru The owner of that action (w9jds) has resolved this issue. Does v1.4.0 or master version work for you? Kindly let me know your result.

try using the --unsafe-perm flag
or configure an env variable:
NPM_CONFIG_USER root before the install