2

I'm trying to set up GitLab CI/CD to deploy to Firebase. I've looked at a few tutorials online and they all say basically the same thing - install firebase tools then deploy with an auth token. However, when I get to this step I get a permission denied message, as shown below.

My .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

And then this is the error I get:

$ 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
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Daniel
  • 536
  • 3
  • 10

0 Answers0