npm install error (code EBADPLATFORM)

2020-07-03 04:43发布

When I tried to run npm install, it gave me this error:

$ 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

The node version:

$node -v
v8.10.0 

I tried every thing, like:

npm cache clear 
npm cache verify
npm i -g npm@latest

I even tried uninstalling and reinstalling Nodejs again but still get the same error.

标签: node.js npm
6条回答
再贱就再见
2楼-- · 2020-07-03 05:12

I had the same issue, deleting my "package-lock.json" and re-running npm install worked

查看更多
你好瞎i
3楼-- · 2020-07-03 05:18

The error says it all:

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

This module doesn't support Windows, you can't use it if you're on Windows.

查看更多
爷、活的狠高调
4楼-- · 2020-07-03 05:19

Error is indicating that you are installing fsevents module in other OS rather than Mac

fsevents module only works for Mac Operting system

查看更多
Animai°情兽
5楼-- · 2020-07-03 05:21

Add peer dependency in your JSON package like below

{
  "name": "chai-as-promised",
  "peerDependencies": {
    "chai": "1.x"
  }
}
查看更多
疯言疯语
6楼-- · 2020-07-03 05:25

Add following to your project's package.json

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

and then install with --no-optional

查看更多
Rolldiameter
7楼-- · 2020-07-03 05:36

Remove "fsevents": "version", on package.json if you try to install on Windows.

查看更多
登录 后发表回答