【问题标题】:GitHub Action failes building firebase app w9jds/firebase-actionGitHub Action 无法构建 firebase 应用程序 w9jds/firebase-action
【发布时间】:2020-10-11 08:06:51
【问题描述】:

我可以在本地命令行中使用 firebase deploy 部署我的 friebase 应用程序 (https://github.com/Luuuuuis/profile-page),但是当我推送它时它一直失败 -> 没有代码错误。

这是我的 GitHub 操作:https://github.com/Luuuuuis/profile-page/blob/master/.github/workflows/main.yml 并且在尝试构建时失败。 https://github.com/Luuuuuis/profile-page/runs/792416930?check_suite_focus=true

这是我得到的错误:

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

昨天已经成功了,但是今天试了好几次都没成功。我的行为有问题吗?

【问题讨论】:

标签: node.js firebase github npm github-actions


【解决方案1】:

尝试使用 --unsafe-perm 标志或配置环境变量: NPM_CONFIG_USER 根

【讨论】:

    【解决方案2】:
    EACCES: permission denied
    

    您应该尝试使用sudo 执行它

    【讨论】:

    • 但是如何在 github 操作中使用 sudo?
    • 我明白了。全局安装软件包似乎有问题。也许你找到了一种在没有 -g 的情况下在本地安装时使用 firebase-tools 的方法。我在这里找到了一些其他方法,但如果它们与 github 操作一起使用,我会发现:docs.npmjs.com/…
    • 但是为什么昨天还有效呢?当我使用这个预制动作时,我不明白我应该如何在没有 -g 的情况下运行它。做这个动作的家伙 -g 会很好吗?
    【解决方案3】:

    这更适合其他人来看这个问题,也许是相关的,但不是确切的问题。对于特定的原始问题,这些问题似乎是一个火力问题。但是,如果像我一样,您在权限方面遇到了类似的问题(正如 phyyyl 的回答中所指出的那样),这就是我修复它的方法。

    为了绕过权限,我使用了the npm docs 中的解释。所以安装时不要使用-g 标志并使用npx,它会识别出安装的程序不是全局安装的。我使用 netlify,所以不确定等效的 firebase 是什么。但我希望这会有所帮助。

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

    【讨论】:

      猜你喜欢
      • 2020-10-05
      • 2020-04-18
      • 2022-12-03
      • 1970-01-01
      • 2020-04-29
      • 2018-12-24
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      相关资源
      最近更新 更多