[grexlin85:~] >sudo npm i -g npm#latest
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ npm#6.13.7
updated 1 package in 5.748s
[grexlin85:~] >npm -v
5.8.0
[grexlin85:~] >sudo npm -v
6.13.7
Hello, I've updated my npm but if I write sudo npm -v it looks like updated but does not update and the version is still same. What can I do?
--------Edit-------
[grexlin85:~] >npm i -g npm#latest
npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/grexlin85/.npm/_logs/2020-02-03T07_50_54_366Z-debug.log
I've tried without sudo and i get this output
Related
I am trying to create a new project and wanted to install NPM in the directory of my project, but it showed these errors. I currently have the latest versions of both NPM and Node.js.
Naomis-Air:~ naomivictoriaobame$ npm -v
7.24.0
Naomis-Air:~ naomivictoriaobame$ npm install npm#latest -g
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! dest /usr/local/lib/node_modules/.npm-i9nnxROI
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/npm',
npm ERR! dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/naomivictoriaobame/.npm/_logs/2021-10-16T20_55_50_627Z-debug.log
Naomis-Air:~ naomivictoriaobame$ npm cache clean --force
npm WARN using --force Recommended protections disabled.
Naomis-Air:~ naomivictoriaobame$
It looks as though the current user needs permission to make change to the npm directory. You can run the following command to give the current user access modify that directory:
sudo chown -R $(whoami) ~/.npm
I've needed to install a number of things with node but ever since I updated my system to Catalina I just get errors that I'm assuming are due to the new security measures on Mac.
The last thing I tried to install was this command:
npm install -g gulp gulp-cli browser-sync
I got this error
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jessiematias/.npm/_logs/2020-03-31T15_45_46_951Z-debug.log
How can I ensure I don't get these errors anymore whenever I try to install something on the command line? It's saying to try running the commmand again as root/Administrator. How do I do that?
I have node 11.2.0
Keep receiving this error.
Andrews-MacBook-Pro:vueTutorial aharris$ npm install -g #vue/cli
npm WARN deprecated hoek#5.0.4: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN #apollographql/apollo-upload-server#5.0.3 requires a peer of graphql#^0.13.1 but none is installed. You must install peer dependencies yourself.
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/aharris/.npm/_logs/2018-11-25T18_43_42_502Z-debug.log
You are facing the problem of file permissions.
-g parameter of npm means "globally", which will install those file in the system directory, specifically in your computer /usr/local/lib/node_modules, where the owner is possibly root and with permission rwxr-xr-x, means those who is not root will have no permission to write.
Then, you may use sudo to get this permission, or just like NPM modules won't install globally without sudo said, set the npm prefix into the path where you have permissions:
$ npm config set prefix '~/.npm-packages'
All you need to do is run the same command with sudo before it,
sudo npm install -g #vue/cli
and you'll be prompted for the admin password.
sachin#sachin-Lenovo-G50-80:~$ npm install -g react-native-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli/node_modules/semver
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/react-native-cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
-- react-native-cli#2.0.1
-- semver#5.6.0
npm ERR! Linux 4.15.0-34-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/react-native-cli/node_modules/semver
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/react-native-cli/node_modules/semver'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/react-native-cli/node_modules/semver'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/react-native-cli/node_modules/semver' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/sachin/npm-debug.log
When you want to install some node package globally, you need admin permission so do it as follows:
$sudo npm install -g react-native-cli
And write your password when asking.
You don't have write access in /usr/local/lib/.
This link might help.
i am trying to install bower version 1.8.2
globally on my Ubuntu 16.04
but it show that Missing write access /usr/local/bin
i have node 4.2.6
and npm 3.5.2
i get this error:
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm install -g bower
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN checkPermissions Missing write access to /usr/local/lib
/usr/local/lib
`-- bower#1.8.2
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/Desktop/Python-2.7.14/npm-debug.log
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ node --version
v4.2.6
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm --version
3.5.2
ubuntu#ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$
You can install it using sudo:
sudo npm i --global bower
But that is not recommended, hence you can fix your npm permissions like this:
sudo chown -R $(whoami) $(npm config get prefix)/lib/node_modules
You can find a gist for the same here.