I had the same issue installing on AWS Linux. I had to install it with sudo
. So to get around this I followed step 3 from this article (making sure to get the latest version of node)
https://www.hostingadvice.com/how-to/update-node-js-latest-version/
wget https://nodejs.org/dist/vx.x.x/node-vx.x.x-linux-x64.tar.xz
tar -C /home/aUser/node --strip-components 1 -xJf node-vx.x.x-linux.x64.tar.xz
But installed it to the user's home directory /home/aUser/node
. Then added that path to my PATH.
export PATH=/home/aUser/node/bin:$PATH
After that I was able to do an npm install
with no issues.