HEXO 安装失败的解决方案

读书是最有意思的旅行方式

2023-12-04 Viewed Times

spawn-sync错误导致hexo安装失败的解决方案。

hexo是一个很好的个人博客解决方案,很多人在使用他,但是现在网上很多教程都比较老,也会出现各种坑,以下就是本人在安装时遇到的一个坑

在安装hexo时 npm install -g hexo-cli后界面卡住无反应。

尝试本地安装,即在pachage.json里面先设置,再npm install 后报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
[root@ubuntu hexo]$ npm install
> spawn-sync@1.0.15 postinstall /root/hexo/node_modules/hexo-renderer-marked/node_modules/hexo-util/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall
module.js:339
throw err;
^
Error: Cannot find module '/root/hexo/node_modules/hexo-renderer-marked/node_modules/hexo-util/node_modules/cross-spawn/node_modules/spawn-sync/postinstall'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
npm WARN optional dep failed, continuing fsevents@1.0.8
npm WARN optional dep failed, continuing fsevents@1.0.8
\
> spawn-sync@1.0.15 postinstall /root/hexo/node_modules/hexo/node_modules/hexo-util/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall
module.js:339
throw err;
^
Error: Cannot find module '/root/hexo/node_modules/hexo/node_modules/hexo-util/node_modules/cross-spawn/node_modules/spawn-sync/postinstall'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
\
> dtrace-provider@0.6.0 install /root/hexo/node_modules/hexo/node_modules/hexo-log/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js
module.js:339
throw err;
^
Error: Cannot find module '/root/hexo/node_modules/hexo/node_modules/hexo-log/node_modules/bunyan/node_modules/dtrace-provider/scripts/install.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
npm WARN optional dep failed, continuing dtrace-provider@0.6.0
npm ERR! Linux 4.1.7-v7+
npm ERR! argv "/usr/local/nodejs/bin/node" "/usr/local/nodejs/bin/npm" "install"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script 'node postinstall'.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall
npm ERR! You can get their info via:
npm ERR! npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/hexo/npm-debug.log

可以使用以下解决方案:

1
npm install -g --unsafe-perm hexo-cli

如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !