Reputation: 3754
I'm getting an error when trying to deploy using azure pipelines.
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
I think its becuase the node_modules folder is not being shared between stages. But I cant figure out what is proper way to do it.
Here is my yaml file:
variables:
- group: netlify
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Build
jobs:
- job: ARM
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
npm install
npm run unit
displayName: 'Setup and test'
- script: npm run build
- publish: $(System.DefaultWorkingDirectory)
artifact: dist
- stage: Deploy
dependsOn: Build
condition: succeeded()
jobs:
- job: APP
steps:
- bash: |
npm i -g netlify-cli
netlify deploy --site $(NETLIFY_SITE_ID) --auth $(NETLIFY_AUTH_TOKEN) --prod
After running npm install, package node_modules should appear somehwere in the directory but it seems its not properly shared.
Upvotes: 7
Views: 13788
Reputation: 18958
You are using Ubuntu
image, and trying to global install netlify-cli
in Linux without sudo
.
If the Ubuntu
is the necessary system you must use, you'd better add sudo
before this command:
sudo npm i -g netlify-cli
Command succeed on my pipeline
In this doc, Upgrading on *nix (OSX, Linux, etc.):
You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.
Same in VSTS, you must use sudo
in the command to let you has password-less sudo rights for Ubuntu
.
Another way is change the image to vs2017-win2016
if you do not has any special requirements for the build environment:
pool:
vmImage: 'vs2017-win2016'
When using this image, you could install anything and do not need use sudo
.
In fact, we has been pre-installed many basic tools in all hosted images, including node.js
In our github description, we listed all tools that pre-installed for all images. You can check to know more about VSTS.
Upvotes: 8