permission denied when run hexo #2314

Open
Arondight opened this Issue Dec 16, 2016 · 10 comments

Projects

None yet

3 participants

@Arondight
$ hexo
fs.js:557
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/usr/lib/node_modules/.hexo_npminstall/arr-flatten/1.0.1/arr-flatten/index.js'
    at Object.fs.openSync (fs.js:557:18)
    at Object.fs.readFileSync (fs.js:467:33)
    at Object.Module._extensions..js (module.js:579:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/.hexo_npminstall/arr-diff/2.0.0/arr-diff/index.js:10:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
-------------------------------------------------

any args failed.

@jffree
jffree commented Dec 16, 2016

wrong mod of file /usr/lib/node_modules/.hexo_npminstall/arr-flatten/1.0.1/arr-flatten/index.js

$ stat /usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js
  文件:'/usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js'
  大小:512       	块:8          IO 块:4096   普通文件
设备:fd00h/64768d	Inode:1051863     硬链接:1
权限:(0700/-rwx------)  Uid:(  501/ UNKNOWN)   Gid:(   20/   games)
最近访问:2016-12-16 17:25:47.000000000 +0800
最近更改:2015-03-25 11:46:00.000000000 +0800
最近改动:2016-12-16 17:25:47.668504400 +0800
创建时间:-
$ sudo chmod -v 0755 /usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js
mode of '/usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js' changed from 0700 (rwx------) to 0755 (rwxr-xr-x)
$ sudo chown -v root:root /usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js
changed ownership of '/usr/lib/node_modules/hexo-cli/node_modules/.0.2.1@array-unique/index.js' from 501:games to root:root

then sky trun blue

@NoahDragon
Member

Although Hexo does not need sudo permission, please try to use sudo hexo in your environment.

@Arondight

It is terrible to use hexo with root privilege.

@NoahDragon
Member

@Arondight did you install the Hexo with sudo, or npm/nodejs is installed as root user?

@Arondight

@PrimeLife yes i do and all things done with root

$ sudo pacman -S npm
$ sudo npm install -g hexo-cli
$ hexo # boom
@Arondight

@PrimeLife also hexo crash after i update with command npm install -g hexo-cli

PS: i use registry.npm.taobao.org as upstream

@NoahDragon
Member

I see. You can reinstall npm without sudo, then run npm install -g hexo-cli should fix this issue.

@Arondight

@NoahDragon did I hear that right? install npm without sudo? how can i tell my package manager to do it?

@NoahDragon
Member

I don't know what exactly to do in your environment. You could simply remove sudo in the command and give it a try.

@Arondight

@PrimeLife sorry it is not simple and i will not try

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