Can not instal Angular cli on MacOS High Sierra v10.13.2 - javascript

I have a problem installing Angular cli. I Instal the latest NodeJs v8.9.4 and npm v5.6.0. When I start installing npm install -g #angular/cli after that shows this message:
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.
Operating system: MacOS High Sierra v10.13.2
I am not expert but if I understand I do not have permission to install. Thank you for your help 😊.

Sorry for so long to reply. sudo npm install -g #angular/cli did not help me. I get the same result.
Basically, this is how I solve the problem.
To not get "permission denied" to installing nodejs and npm on macOS High Sierra. I used https://brew.sh . Allowed to install without errors or "permission denied".
Here is some source:
https://nodejs.org/en/download/package-manager/#macos
https://github.com/creationix/nvm/blob/master/README.md#mac-os-troubleshooting

You need to use this:
sudo npm install -g #angular/cli
and then enter your administrator password when prompted.
There's a debate on whether you should ever use sudo when using npm install -g, but I use sudo like this when I need to and haven't suffered for it.
Here's a similar stackoverflow question about this:
npm throws error without sudo

Related

Angular CLI installation error in ubunu - I have get an error when I am trying to run angular CLI command in my ubuntu machine

This error I have got.
I am already install node js and npm in my system.
I also have remove npm cache.
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! 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/user/.npm/_logs/2020-11-03T18_21_04_293Z-debug.log
~~~
Don't use sudo for this problem. Use sudo the way it is intended to be used in Ubuntu: for each command that requires it, no more. Don't use sudo to run a command unless it needs to be root. For example, most users would only need sudo for installing things.
Have you try, manually change npm's default directory?
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
To test your new configuration, install a package globally without using sudo:
npm install -g #angular/cli

permissions issue when trying to update npm

I tried to update to the latest version of npm and got this error? Anyone ever have a permission error with npm before? I'm stuck as to how to fix it.
marshalls-MacBook-Air:Desktop marshall$ npm install npm#latest -g
npm WARN checkPermissions Missing write access to /usr/local/Cellar/node/11.9.0/lib/node_modules
npm ERR! path /usr/local/Cellar/node/11.9.0/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/Cellar/node/11.9.0/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/Cellar/node/11.9.0/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/Cellar/node/11.9.0/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/Cellar/node/11.9.0/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/marshall/.npm/_logs/2019-09-24T17_21_36_708Z-debug.log
you need permission :
sudo npm install npm#latest -g
then put your password

nodemon package is not install in nodejs [duplicate]

This question already has answers here:
How to fix npm throwing error without sudo
(39 answers)
Closed 3 years ago.
nodemon package does not successfully install using nodejs. I used npm install -g nodmon. I received the permissions-related error below.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/nodemon/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! path ../lib/node_modules/nodemon/bin/nodemon.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/bin/nodemon'
npm ERR! { [Error: EACCES: permission denied, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/bin/nodemon']
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/bin/nodemon'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/nodemon/bin/nodemon.js',
npm ERR! dest: '/usr/bin/nodemon' },
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, symlink \'../lib/node_modules/nodemon/bin/nodemon.js\' -> \'/usr/bin/nodemon\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/nodemon/bin/nodemon.js',
npm ERR! dest: '/usr/bin/nodemon' }
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/etech7/.npm/_logs/2019-07-02T11_31_52_856Z-debug.log
Try to install it with sudo. It it because you need admin permissions.
sudo npm install -g nodemon
Hope it helps!
This is a permissions issue, as indicated by the error message. You need to fix your permissions or use sudo. Please see: npm throws error without sudo

I'm trying to update my magic mirror using npm, using the following command in terminal: npm install -g npm

pi#raspberrypi:~ $ npm install -g npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm'
npm ERR! { [Error: EACCES: permission denied, access '/usr/lib/node_modules/npm']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/npm\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/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/pi/.npm/_logs/2019-01-13T02_13_34_227Z-debug.log
pi#raspberrypi:~ $
sudo npm install -g npm
Sudo is the key here. May the force be with you.

create-react-app newproject commandline is not working for me

for some reason ive been ending up with "command not found" when i type in the create-react-app newproject command. Its been giving me this error:
npm WARN checkPermissions Missing write access to /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
npm ERR! path /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app'
npm ERR! { Error: EACCES: permission denied, access '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/Users/kennyquach/.npm-global/lib/node_modules/create-react-app\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app' }
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/kennyquach/.npm/_logs/2018-11-28T17_50_32_739Z-debug.log
any help is appreciated! Thanks!
As the error clearly shows you dont have write access to /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
try changing access to 777 for all of .npm-global folders and then give a try.
You are high likely using Mac OS as Operating System. This is a general issue of globally installed packages in MacOS that caused by built-in node application's file permissions. Actually you can get over this by executing create-react-app as root, but i don't recommend that, it's not useful and it's risky.
So you got 2 options. (First one is hard to do, second is blazing fast)
1-) Completely remove Node from your System and install it with Brew. You can easily update node with that package manager and install any other popular developer tools too (Like: mongodb, mysql, pgsql, rabbitmq etc.).
You can get brew from here: https://brew.sh and install node with that code: brew install node
2-) You can easily give read, write, execute access to your folders and files. You can do it like this: sudo chmod -R 777 /Users/kennyquach/.npm-global/ when sudo asks your password, use your Administrator password.
This looks like an access issue. I faced same issue in MAC OS X, when I tried running the command with sudo, it worked for me.
sudo npm install -g create-react-app

Categories

Resources