权限被拒绝的错误在GitLab中安装Firebase-Tools

时间:2018-12-18 01:29:24

标签: firebase npm-install gitlab-ci firebase-tools

我正在尝试将GitLab CI / CD设置为部署到Firebase。我在网上看了一些教程,他们都说基本相同的事情-安装firebase工具,然后使用auth令牌进行部署。但是,当我执行此步骤时,会收到一条权限被拒绝的消息,如下所示。

我的.gitlab-ci.yml:

image: node:latest

stages:
  - build
  - deploy

app-build:
  stage: build
  script:
    - npm install
    - npm run build

deploy_production:
  stage: deploy
  environment: Production
  only:
    - master
  script:
    - npm install -g firebase-tools
    - firebase use --token $FIREBASE_DEPLOY_KEY
    - firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY

然后这就是我得到的错误:

$ npm install -g firebase-tools
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'\n    at Error (native)',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitlab-runner/.npm/_logs/2018-12-18T01_23_52_755Z-debug.log
ERROR: Job failed: exit status 1

0 个答案:

没有答案