【问题标题】:Error when installing node package?安装节点包时出错?
【发布时间】:2017-03-02 10:12:14
【问题描述】:

我是 nodejs 新手,在我的项目中运行 npm install 时出现错误。

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v7.7.1
npm ERR! npm  v4.1.2
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin",
"arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR!     C:\projects\rehouse\src\dd_rehouse_renewal_win\npm-debug.log

我不知道这个错误:Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin", "arch":"any"} (current: {"os":"win32","arch":"x64"}) 请帮我解决。

【问题讨论】:

  • 好吧,“wanted os darwin (current win32)”对我来说听起来就像 fsevents 是什么,它需要 MacOS 而不是 windows。但我对节点不够熟悉,不知道该怎么做:/
  • 可能是版本问题,看这棵树github.com/npm/npm/issues/14042
  • 也尝试npm cache clean,然后再次运行您的命令
  • 谢谢大家,在我的npm-shrinkwrap.json 中为 fsevents 添加optional: true, 并使用npm i --no-optional 运行后,我解决了我的问题

标签: node.js npm npm-install


【解决方案1】:

this 讨论中,我会先尝试方法 1。如果这不起作用,请尝试方法 2。

  1. 添加:

    "optionalDependencies": { "fsevents": "*" },

    到你的 package.json 然后用--no-optional安装

  2. 尝试将您的 npm 版本降级到下一个较低的稳定版本。

【讨论】:

    猜你喜欢
    • 2014-02-04
    • 2015-08-29
    • 1970-01-01
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 2020-04-25
    • 2019-12-09
    相关资源
    最近更新 更多