Node version(node -v):
Your site _config.yml (Optional):
Your theme _config.yml (Optional):
Hexo and Plugin version(npm ls --depth 0):
ๅจๆ่ๆๆบไธๅฎ่ฃ
ไบ git Node.js ็ถๅ npm install -g hexo-cli
ๆฅ้ๅฆไธ
[root@test ~]# npm install -g hexo-cli
/root/.nvm/versions/node/v8.3.0/bin/hexo -> /root/.nvm/versions/node/v8.3.0/lib/node_modules/hexo-cli/bin/hexo
[email protected] install /root/.nvm/versions/node/v8.3.0/lib/node_modules/hexo-cli/node_modules/dtrace-provider
node scripts/install.js
[email protected] postinstall /root/.nvm/versions/node/v8.3.0/lib/node_modules/hexo-cli/node_modules/hexo-util
npm run build:highlight
[email protected] build:highlight /root/.nvm/versions/node/v8.3.0/lib/node_modules/hexo-cli/node_modules/hexo-util
node scripts/build_highlight_alias.js > highlight_alias.json
sh: highlight_alias.json: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:highlight: node scripts/build_highlight_alias.js > highlight_alias.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:highlight script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ npm update check failed โ
โ Try running with sudo or get access โ
โ to the local update config store via โ
โ sudo chown -R $USER:$(id -gn $USER) /root/.config โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/hexo-cli/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! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: npm run build:highlight
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-08-10T10_43_53_873Z-debug.log
[root@test ~]# hexo init
-bash: hexo: command not found
ๆไน่งฃๅณ ๏ผ๏ผ๏ผ๏ผ
Have you tried the solution listed here?
I ran into this just last night. node 8.3.0 from nodesource repo (so there is a node executable). What I ended up doing was just doing a regular install, then moving hexo-cli to /usr/lib/node_modules, then creating a node_modules folder within it, and moving the remaining packages there.
Having to chown directories to get it to install is not an optimal solution; the fact that it's not even mentioned on the Overview page means that a lot of people are going to try it and quit before they even get started. sudo npm install -g hexo-cli should get the job done; if it doesn't, or it doesn't in certain known environments, that needs to be part of the instructions.
I say that to say, I wouldn't close these types of issues because you can chown and get around it. I don't have the npm knowledge to fix this particular issue, but if you keep an issue open for it (with an "up for grabs" tag, if the project uses them), maybe someone in the community will come along who can fix it. (Of course, since hexo-util is a separate package, the issue probably belongs on that repo; but, since it impacts the entire hexo install, an issue here that tracks the other issue would be good.)
ไฝ ่ฏ่ฏๅๆขๅฐ้root็จๆท
i meet up with the problem alike you
I tried this on CentOS 7 as well, and it failed also; however, the error message was a bit more informative. Error: EACCESS: permission denied, scandir '/root/.npm/_logs'
I'm planning on writing a shell script (as a gist) that will work around this. If this remains open, at some point I'll look at that script and see what it's doing that's causing it to lose administrative privileges.
Here is the workaround script; this will install hexo-cli globally, without requiring the user to change permissions on /usr/lib/node_modules.
Using yarn instead of npm fixes it:
sudo yarn global add hexo-cli
Most helpful comment
Here is the workaround script; this will install
hexo-cliglobally, without requiring the user to change permissions on/usr/lib/node_modules.