root@debian:~# node --version
v7.8.0
root@debian:~# npm --version
4.2.0
root@debian:~#
root@debian:~/blog# npm install hexo-cli -g
/opt/nodejs/bin/hexo -> /opt/nodejs/lib/node_modules/hexo-cli/bin/hexo
> [email protected] install /opt/nodejs/lib/node_modules/hexo-cli/node_modules/dtrace-provider
> node scripts/install.js
> [email protected] postinstall /opt/nodejs/lib/node_modules/hexo-cli/node_modules/hexo-util
> npm run build:highlight
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/opt/nodejs/bin/node" "/opt/nodejs/bin/npm" "run" "build:highlight"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! path /root/.npm/_logs
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall scandir
npm ERR! Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR! { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'scandir',
npm ERR! path: '/root/.npm/_logs' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
glob error { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs' }
> [email protected] build:highlight /opt/nodejs/lib/node_modules/hexo-cli/node_modules/hexo-util
> node scripts/build_highlight_alias.js > highlight_alias.json
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/opt/nodejs/bin/node" "/opt/nodejs/bin/npm" "run" "build:highlight"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! Callback called more than once.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-04-10T06_43_17_446Z-debug.log
/opt/nodejs/lib
└── (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/opt/nodejs/bin/node" "/opt/nodejs/bin/npm" "install" "hexo-cli" "-g"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 243
npm ERR! [email protected] postinstall: `npm run build:highlight`
npm ERR! Exit status 243
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'npm run build:highlight'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hexo-util package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build:highlight
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hexo-util
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hexo-util
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-04-10T06_43_20_889Z-debug.log
root@debian:~/blog#
https://github.com/hexojs/hexo-util/issues/9
Will the following solution in the above issue fix?
$ cd /usr/bin
$ ln -s nodejs node
Hi,
I just bumped into the same issue today with the latest docker image of nodejs. This issue can be reproduced by the following command:
# docker run -t --rm node:latest npm install -g hexo-util
It seems that the postinstall script is reading /root/.npm/_logs with a uid other than root, and here is a (dirty & insecure) workaround:
# chmod 755 /root && mkdir -m 755 -p /root/.npm/_logs
# npm install -g hexo-cli
# chmod 700 /root
CAUTION: THIS WOULD CHANGE PERMISSION OF /root! Use docker container if you want to give it a try.
same problem on my manjaro linux.
workaround:
root@xxxxxxxxxx:~# npm config set user 0
root@xxxxxxxxxx:~# npm config set unsafe-perm true
root@xxxxxxxxxx:~# npm install -g hexo
@Escapingbug you can try this aur https://aur.archlinux.org/packages/nodejs-hexo-cli/
Safer workaround (I'm not sure about docker image):
chown -R the node_modules directory to a user other than root,npm install -g hexo-cli as that user,chown -R the node_modules directory back to root,@Escapingbug anoter workround——ArchLinux (and other distros base on arch ,eg.manjaro) also can install 'hexo-cli' from aur:yaourt -S nodejs-hexo-cli.
Most helpful comment
workaround: