Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli #2545

Closed
moseslv opened this issue May 2, 2017 · 12 comments

Comments

@moseslv
Copy link

moseslv commented May 2, 2017

Hi all,
The first time i tried to install Hexo it was successful but when i tried to use the "hexo g" and "hexo i" , there always exist some mistakes. So i manually delete the hexo files along with the NodeJs files and reinstall them all. The thing is , this time, i cannot install Hexo correctly. In my terminal, there always some mistakes like below.
screen shot 2017-05-02 at 3 33 39 pm

Can anyon shine some light on this issues please. Thanks,

Environment Info

Node version(node -v):

Your site _config.yml (Optional):

Your theme _config.yml (Optional):

Hexo and Plugin version(npm ls --depth 0):

For BUG

For question

For feature request

@NoahDragon
Copy link
Member

Have you tried to run the command with sudo?

@dayisi
Copy link

dayisi commented Jan 11, 2018

I just met the same problem when installing hexo with npm install -g hexo-cli. And after I add sudo before the command, the problem is solved.

@JLHwung
Copy link
Collaborator

JLHwung commented Jan 11, 2018

@dayisi Please do not run sudo npm install -g hexo-cli, see #2785 (comment)

@dayisi
Copy link

dayisi commented Jan 13, 2018

@JLHwung Thank you for reminding me and I have run the fix code u post in #2785(comment. But when i run npm install hexo-cli -g, I still meet the same

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/hexo-cli

problem. Could u please tell me why i shouldn't run sudo and how to fix the problem of the nom WARN ...? Thank you!

@auxiliaryjoel
Copy link

any solution for this? I get the warning when I am using terminal to:
npm install bower -g

@axelpale
Copy link

axelpale commented Jun 24, 2018

Arrived here to find a solution to a similar problem where node_modules under a home directory created a similar error. The problem was solved by this answer by removing the node_modules directory and trying to install again. Maybe the solution helps here too. It feels like that some caches in node_modules were not updated after a change in the path of some package, thus causing the error.

@dragondiego7
Copy link

same problem here. I am try with apiconect for IBM. npm install -g apiconnect generate the same issue with

npm ERRO

@jedidrew42
Copy link

jedidrew42 commented Nov 15, 2019

I am having same issue I ran using sudo

npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli/node_modules/es6-symbol npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli/node_modules/es5-ext npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli/node_modules/graceful-fs npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli/node_modules/hosted-git-info npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli npm WARN checkPermissions Missing write access to /usr/lib/node_modules/gulp-cli/node_modules npm WARN checkPermissions Missing write access to /usr/lib/node_modules npm ERR! path /usr/lib/node_modules/gulp-cli/node_modules/es6-symbol npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/gulp-cli/node_modules/es6-symbol' npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules/gulp-cli/node_modules/es6-symbol' npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules/gulp-cli/node_modules/es6-symbol\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/lib/node_modules/gulp-cli/node_modules/es6-symbol' } 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).

@vallamost
Copy link

vallamost commented Dec 3, 2019

Isn't the point of -g to make the module globally accessible? To make it globally accessible on the system, node needs to install it to /usr/lib/node_modules/, this folder can only be written to by root, so that's why you need sudo permissions to use -g.

To me sudo is the correct method for using -g. But you should refrain from installing modules globally unless you know what you are doing. If a malicious module was installed at the system level...you get the idea. Refrain from using sudo as much as possible and try to keep modules local to your application's environment.

From the npmjs site:

tl;dr:
Local install (default): puts stuff in ./node_modules of the current package root.  
Global install (with -g): puts stuff in /usr/local or wherever node is installed.  
Install it locally if you’re going to require() it.  
Install it globally if you’re going to run it on the command line.

source: https://docs.npmjs.com/files/folders

@Leehyunji0715
Copy link

I had a similar issue. After searching on Google, I found that I had a problem with npm.
I've referenced this site (https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally)

@NicolasWesleyJS
Copy link

Thanks @Leehyunji0715, It's works for me!

@Joelthobias
Copy link

you can use this with a starting sudo
or
su -
and then
npm install -g and then the name of package

example error and solution is given below
Screenshot from 2020-09-15 14-35-15
Screenshot from 2020-09-15 14-35-39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests