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

Created on 25 Feb 2019  ·  21Comments  ·  Source: hexojs/hexo

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 [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer
npm WARN rollback Rolling back [email protected] 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: [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":"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

stale

Most helpful comment

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

All 21 comments

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

I have the same problem.

me too

npm ERR! path /usr/local/lib/node_modules/hexo-cli/node_modules/highlight.js/tools/build.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/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.

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)

same issue 😢

C:\Users\LeoJh>npm install -g hexo-cli
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\globby\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules'
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":"win32","arch":"x64"})

npm ERR! path C:\Users\LeoJh\AppData\Roaming\npm\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:\Users\LeoJh\AppData\Roaming\npm\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

looking forward to the solution 💪

same

The issue comes from highlight.js
The dependency chain is hexo-cli > [email protected] > highlight.[email protected]
but highlight.js version 9.15.2 was supposed to solve the issue

same

npm ERR! path /Users/jiatuo/.nvm/versions/node/v8.0.0/lib/node_modules/hexo-cli/node_modules/highlight.js/tools/build.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/jiatuo/.nvm/versions/node/v8.0.0/lib/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! /Users/jiatuo/.npm/_logs/2019-02-25T15_40_13_196Z-debug.log

同样的问题 😢

C:\Users\LeoJh>npm install -g hexo-cli
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\globby\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\LeoJh\AppData\Roaming\npm\node_modules\hexo-cli\node_modules'
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":"win32","arch":"x64"})

npm ERR! path C:\Users\LeoJh\AppData\Roaming\npm\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:\Users\LeoJh\AppData\Roaming\npm\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

期待解决方案 💪

同样的问题,求解决

same o on Debian Buster with NodeJS 10 from nodesource,
where hexo was working 2weeks ago
and even I purge my nodejs

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

I'm able to hexo serve my hexo project/blog again

simply by executing npm shrinkwrap than npm install inside my hexo project
as proposed @chocoluffy in is Option 2

同样的问题

I can install now, nothing change

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

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 [email protected] hexo-cli (ensuring highlight.js was using the previous version).

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

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 [email protected] hexo-cli (ensuring highlight.js was using the previous version).

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

Thanks very much! I got my hexo working properly by running npm install -g [email protected] hexo-cli !

Latest version 9.15.6 is working fine!

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I have the same problem.Why?

Was this page helpful?
0 / 5 - 0 ratings