Some of my node modules get installed but there are always these sort of issues on this particular linux mint machine
npm install
npm ERR! Error: EACCES, open '/home/me/.npm/semver/3.0.1/package/package.json'
npm ERR! { [Error: EACCES, open '/home/me/.npm/semver/3.0.1/package/package.json']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/me/.npm/semver/3.0.1/package/package.json',
npm ERR! parent: 'gulp' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
If you encounter “Error: EACCES: permission denied” while installing Typescript or any other program, it is due to permission problems. npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' In short, that means you do not have permission to install.
The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.
This code fix it for me.
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
UPDATE. See this answer for a better way.
You have to set correct permissions (ownership) so npm
can access your (sub)directories with your normal user permissions:
sudo chown -R $USER <directory>
where in your case <directory>
is /home/me
and -R
is for recursive to also change ownership of all your subdirectories, which is exactly what you want. That should fix the EACCESS
issue.
Sadly the advise to run the command as root/Administrator
is wrong here.
You want to avoid running npm
with sudo
ever, as recommended by the npm
creator Isaac Schlueter:
I strongly encourage you not to do package management with sudo! Packages can run arbitrary scripts, which makes sudoing a package manager command as safe as a chainsaw haircut. Sure, it’s fast and definitely going to cut through any obstacles, but you might actually want that obstacle to stay there.
See here for more details.
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