Open NatoBoram opened 5 years ago
That's happened because you install NodeJs using Snap package from Snap Store, which is had different permission with packages are installed from APT https://snapcraft.io/docs/permission-requests
You can uninstall/remove currently installation, after that you should re-install using APT, follow instruction from https://github.com/nodesource/distributions#debinstall
Try use option --scripts-prepend-node-path to run npm command
@brunohonda thank you! That's worked for me.
@hafizkurniaaji Node is installed with --classic
confinement, so it has access to the whole system. The only part it cannot edit is what is under /snap
. So normally an npm
package will be installed under /usr
and will need administrator privileges, or the packages location should be changed using https://docs.npmjs.com/getting-started/fixing-npm-permissions (which had already been linked).
Still, this doesn't make clear why the original error appear. Does wd
attempts to make any filesystem operation in the same folder where node
lies?
Try use option --scripts-prepend-node-path to run npm command
It solved my problem.
If using the snap, it could also be related to https://github.com/nodejs/node/issues/37982 and https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753
Try use option --scripts-prepend-node-path to run npm command
Solved here, but idk exactly what this is 👀
--scripts-prepend-node-path
npm run
sets the NODE environment variable to the node executable with which npm is executed. Also, if the--scripts-prepend-node-path
is passed, the directory within which node resides is added to the PATH. If--scripts-prepend-node-path=auto
is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH.
Run following commands.. It worked for me 1) sudo apt-get update 2) sudo apt-get install nodejs ( #### Reinstall nodejs ) 3) sudo npm install -g @angular/cli ( I was facing issue with angular installation.. but your case might be with different installation )
@Yog4Prog yes, that's node package from the archives. The issue is likely because of the node snap, see my previous comment:
If using the snap, it could also be related to nodejs/node#37982 and https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753
Many people solved similar issues also by following Option 2 described here: https://npm.github.io/installation-setup-docs/installing/a-note-on-permissions.html
--scripts-prepend-node-path
This worked perfectly thanks
I ended up using:
sudo npm install -g @vue/cli --scripts-prepend-node-path
I was trying to
sudo npm install -g polymer-cli
, when suddenly,wd
tried to create/nonexistent/snap/node/1889
. I don't really know what's happening, so I'm reporting it here.