GitHub Action failes building firebase app w9jds/firebase-action

Viewed 855

I can deploy my friebase app (https://github.com/Luuuuuis/profile-page) using firebase deploy in my local command line, but when I push it it keep failing -> No code error.

This is my GitHub Action: https://github.com/Luuuuuis/profile-page/blob/master/.github/workflows/main.yml and it fails when trying to build. https://github.com/Luuuuuis/profile-page/runs/792416930?check_suite_focus=true

This is the error I get:

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/index.js' at Object.openSync (fs.js:443:3) at Object.writeFileSync (fs.js:1194:35) at /usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:35:15 at Object. (/usr/local/lib/node_modules/firebase-tools/node_modules/storage-engine/lib/compatibility/detect.js:45:3) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! storage-engine@3.0.7 postinstall: node ./compatibility/detect.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the storage-engine@3.0.7 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-06-21T10_52_59_937Z-debug.log The command '/bin/sh -c npm install -g firebase-tools' returned a non-zero code: 1 ##[error]Docker build failed with exit code 1

It already worked yesterday, but when I tried it today multiple times it didn't work. Is something wrong with my action?

3 Answers

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

EACCES: permission denied

You should try execute it with sudo

This is more for others coming to see this question, maybe for related, but not exact problems. For the specific original problem, the issues seems to be a firebase issue. But, if like me, you had a similar problem with permissions (as pointed out in phyyyl's answer), this is how I fixed it.

To bypass the permissions, I used the explanation found in the npm docs. So install without the -g flag and use npx, which recognizes that the installed program was not installed globally. I use netlify, so not sure what the equivalent firebase would be. But I hope this helps.

deploy:
    image: node:latest
    stage: deploy
    before_script:
        - npm install netlify-cli
    script:
        - npx netlify deploy --dir public
Related