hexo: Error when run "npm install -g hexo-cli"

Environment Info

System: Win10 64bit

Node version(node -v): 11.10.0 (10.15,1 also does not work for me)

the consele output is:

`PS C:\Windows\system32> npm install -g hexo-cli
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated hoek@0.9.1: The major version is no longer supported. Please update to 4.x or newer
npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Program Files\nodejs\node_modules\hexo-cli\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\hexo-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! path C:\Program Files\nodejs\node_modules\hexo-cli\node_modules\highlight.js\tools\build.js
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Program Files\nodejs\node_modules\hexo-cli\node_modules\highlight.js\tools\build.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\neway\AppData\Roaming\npm-cache\_logs\2019-02-25T09_41_38_938Z-debug.log
PS C:\Windows\system32> node -v`

For BUG

Cannot install hexo

For feature request

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 22 (3 by maintainers)

Most upvoted comments

(Option 1) npm install -g hexo-cli --ignore-scripts can help, as it simply download the packages without building it, thus it will avoid the error caused by dep package like here in highlight.js. But use it with caution, as it may cause other useful packages to stop building as well.

(Option 2) I recommend install packages from your npm-shrinkwrap.json file instead of directly installing latest hexo-cli, as this package is currently affected by its deps highlight.js and waiting for fix.

So do npm shrinkwrap to generate above json file, and then npm install will install packages from shrinkwrap locked version, such that you are installing from a known working version, rather the latest one.

I encounter the same problem as title on Travis when deploying my hexo blog, and the above-mentioned tricks help solve the error.

Just copying my workaround here (from my duplicated issue - sorry, my bad. I didn’t see this one). I fixed my CI/CD pipeline by replacing npm install -g hexo-cli with npm install -g highlight.js@9.14.2 hexo-cli (ensuring highlight.js was using the previous version).

Fixed my pipeline. Not a long term solution, but works as a stopgap.

same problem on a debian docker install that worked previously. I see package.json was updated 17 hours ago in hexo-cli so I wonder if that caused the problem

edit: I’m getting the same error when trying to install highlight.js by itself whereas mocha installs fine. Looking at their github page it seems they are working on it. I’m seeing commits from 5 mins ago.

edit 2: here is the issue tracker for the problem: https://github.com/highlightjs/highlight.js/issues/1984

Latest version 9.15.6 is working fine!

The issue comes from highlight.js The dependency chain is hexo-cli > hexo-util@0.6.3 > highlight.js@9.15.2 but highlight.js version 9.15.2 was supposed to solve the issue

(Option 2) I recommend install packages from your npm-shrinkwrap.json file instead of directly installing latest hexo-cli, as this package is currently affected by its deps highlight.js and waiting for fix.

So do npm shrinkwrap to generate above json file, and then npm install will install packages from shrinkwrap locked version, such that you are installing from a known working version, rather the latest one.

I encounter the same problem as title on Travis when deploying my hexo blog, and the above-mentioned tricks help solve the error.

That is awesome thank you!!! The upside of things like this happening is you learn new stuff like this.

Yep, @digitalap3 you have the right link. I believe you can still install by adding --ignore-scripts to the command

npm install -g hexo-cli --ignore-scripts (but I’m unsure of the impacts)