When I install npm install -g ionic cordova It throws below error
npm WARN checkPermissions Missing write access to
/usr/lib/node_modules npm ERR! path /usr/lib/node_modules npm ERR!
code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error:
EACCES: permission denied, access '/usr/lib/node_modules' npm ERR! {
Error: EACCES: permission denied, access '/usr/lib/node_modules' npm
ERR! stack: 'Error: EACCES: permission denied, access
\'/usr/lib/node_modules\'', npm ERR! errno: -13, npm ERR! code:
'EACCES', npm ERR! syscall: 'access', npm ERR! path:
'/usr/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!
/home/javauser/.npm/_logs/2018-05-19T04_42_24_737Z-debug.log
I tried with root user as well.
I am using node v9.11.1 , npm 6.0.1
Never use npm with sudo (or as root)! You can create potential backdoor to your system.
I have just answered a very similar question in the following link: How to fix the problem with vue.js instalation
Basicaly what is happening is that NPM does not have the privileges to access /usr/local/lib. To give it access, you could change the ownership of ~/.npm in order to belong to your current user. This could be this way:
sudo chown -R $(whoami) ~/.npm
This way you do not have to run npm as sudo, which is not recomended. I believe that it is due to vulnerabilities that are known in npm packages.
Here is an article about it: Don't use "sudo" with npm "install"
run with sudo in Mac OS or linux
sudo npm install -g ionic cordova
or in windows open cmd with run as administrator
npm install -g ionic cordova
Related
I want to install Gulp 4.0.2 on Mac but it fails due to missing write access.
$ npm i -S gulp -g
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:
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).
Seems Gulp installation requires root privileges but it is not recommended. I don't want to install gulp as administrator :(
Is it possible to create another user w/o root privileges and install Gulp from there? If yes, how to do that?
Any advice will be appreciated, thanks!
You can install gulp local to your project directory rather than globally:
npm install gulp
You can then run the local version using npx:
npx gulp
Note: npx comes bundled with NPM version 5.2+
You could also use a script in your package.json:
"scripts": {
"gulp": "gulp"
}
npm run gulp
Official docs to avoid these permission issues...
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Be sure to try touch ~/.zshrc if you're on a newer mac.
Everytime I try to install something with npm (in this case electron-packager) I run into this error. How can I solve this issue?
I have already tried to give me access by changing the permissions on .npm via chmod, but it didn't work and I also tried it with another node version (installed via nvm: node -v 12.1.0; npm -v 6.9.0) and it didn`t work as well.
$ npm install electron-packager --save-dev
npm ERR! path /Users/felixmoser/.npm/_cacache/index-v5/15/a0
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR! [OperationalError: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR! cause: [Error: EACCES: permission denied, mkdir '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EACCES: permission denied, mkdir ' +
npm ERR! "'/Users/felixmoser/.npm/_cacache/index-v5/15/a0'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/Users/felixmoser/.npm/_cacache/index-v5/15/a0',
npm ERR! parent: 'electron-packager'
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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/felixmoser/.npm/_logs/2019-05-01T14_11_08_530Z-debug.log
I actually don't know what else I should try now and hope, that you guys can help me solve this problem!
change the ownership of .npm folder,
In my case I couldn't figure out the solution so I used
sudo chown -R $(whoami) ~/.npm
Just change the owner of ~/.npm folder to yourself:
sudo chown -R felixmoser ~/.npm
You'll need to enter your password for calling sudo.
There is also a similar problem with permissions when trying to install packages globally with --global or -g. I know it's not your current problem, but I want to add it here because people googling the EACCESS when doing a global install might reach this question as well.
Some people change the system folder privileges allowing non-root users writing in system folder, however here is what they recommend in the documentation:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally/
Back up your computer (including it here because documentation mentions is too, but it feels to me overly cautious)
Then execute:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
Edit your ~/.profile:
export PATH=~/.npm-global/bin:$PATH
Then invoke it with
source ~/.profile
To test your new configuration, install a package globally without using sudo:
npm install -g jshint
Or instead of modifying ~/.profile just use the corresponding ENV variable (but to make it pernament you would have to modify the profile file anyway)
NPM_CONFIG_PREFIX=~/.npm-global
Simply add sudo
So instead of npm install electron-packager --save-dev
Let it be sudo npm install electron-packager --save-dev
Please consider running the instructions at least inside the user's location, for example:
/home/myuser/
express HelloWorld --view=pug
while installing parcel module in nodeJS, via terminal on Mac OS i am getting permission error.
error: checkPermission Missing write access to /usr/local/lib/node_modules
i am new at learning Node Modules. i tried installing(Node , NPM) everything works perfect. but first time installing node module it throwing error. i know its looking for directory of Windows type URL but i don't know how to fix it for mac.
iMac:~ hassan$ node -v
v11.10.0
iMac:~ hassan$ npm -v
6.7.0
iMac:~ hassan$ npm install -g parcel-bundler
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:
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/hassan/.npm/_logs/2019-04-23T13_13_46_848Z-debug.log
i want to install Parcel Bundler for Ui animation on my website.
You'll need to have access to /usr/local/lib/node_modules as a super-admin has, to perform the global installation of parcel-bundler.
As mentionned in the comment and assuming your user is the list of sudoers for this computer, you can simply do :
sudo npm -g install parcel-bundler
If this is not the case, you'll need more permissions on the system to install Parcel. Then you'll be able to :
Add your user as a sudoers in the file sudoers.d (Be careful doing this ! See this tutorial for OSX).
Perform the operation directly as the super-admin of the computer.
I'd prefer the 1st option regarding the long-term administration and security of the computer itself. The other option, while not recommended, is still possible for some cases.
Otherwise, you'll not have permission errors if you choose to install Parcel locally. In this case, just omit the -g flag while running the command (i.e npm install parcel-bundler). It will end up by adding parcel to your package.json file so that you'll be able to install it again later.
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.
Hello i need install node.js via terminal. After install to system the installator wrote me:
Make sure that /usr/local/bin is your $PATH.
After running
echo "$PATH"
It returned
/usr/local/git/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/bin:/usr/local/git/bin:/usr/local/lib
But when i want install by npm install -g less
It shows me:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
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! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
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! Please include the following file with any support request:
npm ERR! /Users/erikmargony/npm-debug.log
What can i do to install it? I feel realy lost.
You need to install as the super user. To do this you write sudo at the begining of the command.
sudo npm install -g less
You will then be asked for your user password.
You can find more information here: npm throws error without sudo
In particular you can change the ownership back to your user login using the following command, taken from the aforementioned answer.
This looks like a permissions issue in your home directory. To reclaim ownership of the .npm directory execute:
sudo chown -R $(whoami) ~/.npm
I would suggest you take the time to understand something about permissions in your operating system, and in particular be careful when using the sudo command. Things can go wrong very quickly when logged in as the super user.