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.
In your project, go to Pipelines > Pipelines. Select Manage security from More actions . Modify the permissions associated with an Azure DevOps group (example: Build Administrators) or individual user. Set permissions by selecting Allow or Deny for the permission for a security group or an individual user.
Azure Pipelines supports continuous integration (CI) and continuous delivery (CD) to continuously test, build, and deploy your code. You accomplish this by defining a pipeline. The latest way to build pipelines is with the YAML pipeline editor. You can also use Classic pipelines with the Classic editor.
Many teams prefer to define their build and release pipelines using YAML (YAML Ain't Markup Language). This allows them to access the same pipeline features as those using the visual designer, but with a markup file that can be managed like any other source file.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With