Issue
I am trying to setup a private build agent for Azure DevOps on Ubuntu. And I need to use npm task for builds.
I tried to use nvm to install the latest node, and the installation was successful:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
nvm install 11.10.1
I can check node -v
and npm -v
. But when the npm task is executed from the pipeline - it fails with
Unable to locate executable file: 'npm'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
In my PATH I have /usr/local/nvm/versions/node/v11.10.1/bin
and ls -l
shows:
lrwxrwxrwx 1 500 500 38 Feb 28 06:00 /usr/local/nvm/versions/node/v11.10.1/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
I also added 777 (just to try it!) for npm-cli.js, and still no luck.
I also found this similar question - https://github.com/Microsoft/azure-pipelines-agent/issues/1862
How to properly install node and npm using nvm on Ubuntu agent for Azure DevOps?
Solution
As a temporarily solution I installed node with
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install nodejs
instead of nvm and it is working fine.
Answered By - JleruOHeP