When I execute command: npm install -g #angular/cli I get an error:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
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! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/my_user_name/.npm/_logs/2017-07-13T13_36_06_285Z-debug.log
And then I tried to execute command: sudo npm install -g #angular/cli but I got an error:
npm ERR! path /usr/local/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin
npm ERR! File exists: /usr/local/bin/ng
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/my_user_name/.npm/_logs/2017-07-13T13_39_01_642Z-debug.log
How can I install Angular-CLI if even sudo priviliges are not sufficient?
It looks like a write issue.
You have two options to use sudo (not the best option) or change the folder owner.
sudo npm install -g #angular/cli
sudo chown -R $USER /usr/local/lib/node_modules
Check content symlink path eventually reinstall duplicity a set rights.
Related
When I run npm install -g typescript the following message shows:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/typescript
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/typescript'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/typescript'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/typescript'
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/alexz/.npm/_logs/2021-12-26T10_45_08_412Z-debug.log
I tried to check if I have successfully installed TypeScript, if I run npm ls typescript it shows:
alexz# /Users/alexz
└── typescript#4.5.4
I am confused if I have installed TypeScript or not, because if I do tsc -v it tells me the tsc command is not found. How do I fix the above problem? Thanks!
It is a permission issue. You could read Resolving EACCES permissions errors when installing packages globally to change npm's permissions or you could use sudo command as below.
It may ask you your computer password.
sudo npm install -g typescript
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 am getting these errors while installing nodemon on my mac
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! 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/apple/.npm/_logs/2021-06-13T14_06_45_374Z-debug.log
So, try
1th.
sudo chown -R YourLaptopName: /usr/local/lib/node_modules
2th.
sudo npm install -g nodemon
3th
nodemon -v
I have downloaded expo cli on ubuntu 20.04 in my root directory but I am unable to download it globally!
I want expo cli to be there globally since it's not recommended to open code editor through root directory.
This is what my terminal shows!
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /usr/local/bin/yarn
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
npm ERR! { [Error: EACCES: permission denied, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn']
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/yarn/bin/yarn.js',
npm ERR! dest: '/usr/local/bin/yarn' },
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, symlink \'../lib/node_modules/yarn/bin/yarn.js\' -> \'/usr/local/bin/yarn\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/yarn/bin/yarn.js',
npm ERR! dest: '/usr/local/bin/yarn' }
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! /home/ritik/.npm/_logs/2020-07-03T19_44_34_737Z-debug.log
This is a permissions issue. you can use sudo to fix this but as a general recommendation never run npm install with sudo because it is a bad idea in general ,you can read more about this here
So To minimize this issue you can configure npm to use a different directory for global packages installations as mentioned in npm docs here
On the command line, In your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
Finnaly try to install expo-cli globally :
npm install -g expo-cli
Or if you want a quick fix you can try this
open a terminal and run :
sudo chown -R $USER:$USER /usr/local/lib/node_modules
try to install expo-cli , run :
npm i -g expo-cli
Also consider to avoid globall installs and use npx when possible read more here
I'm trying to install react native through npm, and I've got a mistake in the console
Air-Anton: ant anton$ npm i -g create-react-native-app
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules 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: '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! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/anton/.npm/_logs/2018-08-12T16_40_46_899Z-debug.log Air-Anton:
ant anton$
Help how can I fix it?
It looks like you need root privileges to install react native cli since you don't have the right perms to install binaries in /usr/local/lib/node_modules.
Run the same command with sudo or login temporarily as root. Try the following
$ sudo npm i -g create-react-native-app
Alternatively, you could login as root
$ su
[Enter root password]
# npm i -g create-react-native-app