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

Created on 2 May 2017  ·  12Comments  ·  Source: hexojs/hexo

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

permission-issues

Most helpful comment

Have you tried to run the command with sudo?

All 12 comments

Have you tried to run the command with sudo?

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.

@dayisi Please do not run sudo npm install -g hexo-cli, see https://github.com/hexojs/hexo/issues/2785#issuecomment-338391933

@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!

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

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.

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

npm ERRO

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).

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

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)

Thanks @Leehyunji0715, It's works for me!

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

Was this page helpful?
0 / 5 - 0 ratings