npm安装错误(代码EBADPLATFORM)

abe*_*ami 10 node.js npm

当我试图运行时npm install,它给了我这个错误:

$ npm install
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@1.1.3: 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! A complete log of this run can be found in:
npm ERR!     C:\Users\Aroma\AppData\Roaming\npm-cache\_logs\2018-03- 
25T11_33_58_338Z-debug.log
Run Code Online (Sandbox Code Playgroud)

节点版本:

$node -v
v8.10.0 
Run Code Online (Sandbox Code Playgroud)

我试过一切,比如:

npm cache clear 
npm cache verify
npm i -g npm@latest
Run Code Online (Sandbox Code Playgroud)

我甚至尝试再次卸载并重新安装Nodejs但仍然得到相同的错误.

小智 20

我有同样的问题,删除我的“包lock.json”并重新运行npm install工作

  • 很有帮助。我在我的主目录中破坏了“package-lock.json”文件,该文件*仅*破坏了那里的安装。 (3认同)

Nis*_*xit 13

错误表示您正在fsevents其他操作系统而不是Mac 中安装模块

fsevents 模块仅适用于Mac Operting系统

  • 我的 package.json 中甚至没有 fsevents 但仍然遇到相同的错误。如何解决这个问题。请告诉我 (2认同)

小智 8

将以下内容添加到项目的 package.json 中

"optionalDependencies": {
    "fsevents": "*"
 },
Run Code Online (Sandbox Code Playgroud)

然后使用--no-可选安装


小智 5

这在 Windows 上对我来说毫不费力:

  1. 转到项目的“package.lock.json”文件
  2. 按“Ctrl+F”(启用关键字搜索)
  3. 输入“达尔文”
  4. 文件中的任何地方都说“达尔文”,将其更改为“win32”

重新启动您的 VS Code,您应该一切顺利。

  • 谢谢。有效!对于 Linux,将其更改为“Linux from 'darwin'” (2认同)
  • 谢谢!刚刚删除了 `"os": [ "darwin" ],` (2认同)

WM1*_*WM1 5

相同的 npm 安装错误(代码 EBADPLATFORM):

我已经将 fsevents 强制到我的 Windows 机器上 npm i -f fsevents... npm 回应“我希望你知道你在做什么”。

要修复,需要

  1. 删除 package-lock.json
  2. 删除 package.json 中的 fsevents@2.3.2 行(您的后缀可能不同)
  3. 重新运行 npm install


Pau*_*aul 1

错误说明了一切:

  Unsupported platform for fsevents@1.1.3: 
  wanted {"os":"darwin","arch":"any"}
  (current: {"os":"win32","arch":"x64"})
Run Code Online (Sandbox Code Playgroud)

该模块不支持Windows,如果您在Windows上则无法使用它。