【问题标题】:Error happens when I run "npm install"运行“npm install”时发生错误
【发布时间】:2018-03-24 05:01:25
【问题描述】:

我打算使用hexo创建我的GitHub博客,当我运行hexo init时,显示如下:

$ hexo init
INFO  Cloning hexo-starter to E:\Blog
Cloning into 'E:\Blog'...
remote: Counting objects: 65, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 65 (delta 0), reused 0 (delta 0), pack-reused 62
Unpacking objects: 100% (65/65), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme- 
landscape.git                                              ) registered for 
path 'themes/landscape'
Cloning into 'E:/Blog/themes/landscape'...
remote: Counting objects: 819, done.
remote: Total 819 (delta 0), reused 0 (delta 0), pack-reused 819
Receiving objects: 100% (819/819), 2.54 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (432/432), done.
Submodule path 'themes/landscape': checked out 
'73a23c51f8487cfcd7c6deec96ccc754                                              
3960d350'
INFO  Install dependencies
▒▒Ϣ: ▒▒▒ṩ▒▒ģʽ▒޷▒▒ҵ▒▒ļ▒▒▒
'npm' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
WARN  Failed to install dependencies. Please run 'npm install' manually!

所以安装依赖失败,所以我通过运行npm install手动添加依赖,显示如下问题:

> nunjucks@3.1.2 postinstall E:\Blog\node_modules\nunjucks
> node postinstall-build.js src

'node' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
npm WARN rollback Rolling back ajv@4.11.8 failed (this is probably 
harmless): EP                                              ERM: operation 
not permitted, lstat 'E:\Blog\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 
(node_modules\fse                                              vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
fsevents@                                              1.1.3: wanted 
{"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}                                              
)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nunjucks@3.1.2 postinstall: `node postinstall-build.js src`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nunjucks@3.1.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional 
log                                              ging output above.

有谁知道如何解决这个问题?

【问题讨论】:

    标签: git npm npm-install hexo


    【解决方案1】:

    你可以试试sudo npm installnpm install

    然后hexo ghexo s

    完成: INFO 开始处理 信息 Hexo 在http://localhost:4000 运行。按 Ctrl+C 停止。

    【讨论】:

      【解决方案2】:

      我今天也遇到了这个问题,用cnpm代替npm解决了。

      cd your-dir-need-nunjucks
      cnpm install
      

      【讨论】:

        猜你喜欢
        • 2020-02-20
        • 1970-01-01
        • 2019-11-21
        • 2022-01-12
        • 2018-11-22
        • 2018-02-07
        • 2019-11-07
        相关资源
        最近更新 更多