【问题标题】:What is npm ERR! code ELIFECYCLE?什么是 npm ERR!代码生命周期?
【发布时间】:2018-09-03 19:03:37
【问题描述】:

我在两个不同的 npm 包上遇到了同样的错误,但似乎无法弄清楚。我检查了this 的答案,我没有运行任何其他服务器。我也尝试过删除我的 module_packages 文件夹,清理 npm cache clean,然后按照许多线程的建议使用 npm i 重新安装,但我仍然遇到同样的错误。

  • Windows 10 64 位
  • 节点 8.9.4
  • npm 5.6.0

C:\Users\hunter\Documents\vid>npm install npm install github:storj/node-libstorj --save

> storj@5.1.0 preinstall C:\Users\hunter\Documents\vid\node_modules\storj
> node ./download.js

Unable to download libstorj for platform: win32 and arch: x64
npm WARN vid@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! storj@5.1.0 preinstall: `node ./download.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the storj@5.1.0 preinstall 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!     C:\Users\hunter\AppData\Roaming\npm-cache\_logs\2018-03-25T15_44_06_578Z-debug.log

任何关于可能导致错误的想法都会有所帮助。

【问题讨论】:

    标签: node.js npm


    【解决方案1】:

    我有好消息和坏消息要告诉你。首先是好消息:您的计算机一切正常。

    坏消息:您要安装的模块与 Windows 操作系统不兼容。查看错误消息的第一行:

    Unable to download libstorj for platform: win32 and arch: x64
    

    GitHub 上已经有针对此问题的未解决问题,请参阅:https://github.com/Storj/node-libstorj/issues/43

    如本期所述,存在多个问题:

    • 下载/解压缩不工作
    • 未编译,因为正在使用一些仅限 linux 的函数(访问函数)
    • 未链接(似乎荨麻和其他链接失败)

    所以你有两个选择:等到这个问题得到解决 - 或者 - 切换你的操作系统;-)

    【讨论】:

    • 好的,是的,我已经联系了他们,因为他们说他们支持 windows(但我假设它目前不稳定)。谢谢你的解释。
    【解决方案2】:

    我在尝试通过 package.json 中的脚本条目运行“usemin”和“imagemin”节点模块时遇到“代码 ELIFECYCLE”错误。这些脚本条目是在 Coursera“全栈开发人员”课程中给出的: "imagemin": "imagemin img/* -o dist/img/ && "usemin": "usemin index.html -d dist -o dist/index.html",

    第一行应该是: "imagemin": "imagemin --out-dir=dist/img/img/**/*.{png,jpg,git}"

    usemin 给出“code ELIFECYLE”错误的问题最终追溯到我安装了 API 版本(“npm install usemin”)而不是 cli 版本(“npm install usemin-cli)。

    希望以上内容能帮助其他小伙伴避免现在看起来像一对明显的错误!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-23
      • 2017-12-27
      • 1970-01-01
      • 1970-01-01
      • 2020-06-25
      • 2021-07-10
      • 2019-09-13
      • 2021-09-15
      相关资源
      最近更新 更多