npm WARN deprecated fsevents windows

有需要下载了一个模板项目,安装ui部分失败,提示:

npm WARN deprecated [email protected]: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetch
ing binaries from AWS, smaller package size
npm ERR! Unexpected end of JSON input while parsing near '...LNCxGNsOAHRWRMGoXrtcI'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-12-06T07_31_31_687Z-debug.log

单独提出来安装:

$ npm install fsevents
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: 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\neoliu6\AppData\Roaming\npm-cache\_logs\2019-12-06T07_33_23_843Z-debug.log

原因明了了,这个包是在mac系统中的,windows没有。查了下资料,大概是windows也不需要,不用安装。

解决方法是,把fsevents依赖放到可选依赖中:

vi package.json

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

重新执行安装(有个坑,需要删除package_lock.json,否则标记会失效,所有依赖都将被安装):

npm install --no-optional

参考资料:

https://stackoverflow.com/questions/41570364/npm-install-not-working-in-windows#

But it says it is optional so I ran $npm install --no-optional and that error went away but I still can't install.

https://github.com/npm/npm/issues/17633

I'm seeing this today with npm 5.3.0. npm install --no-optional works IIF a package-lock.json does not exist. If the package-lock.json file exists, then the flag is ignored and all dependencies get installed.

 

猜你喜欢

转载自www.cnblogs.com/neoliu6/p/11995989.html