当前位置:   article > 正文

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents

npm warn notsup skipping optional dependency: unsupported platform for fseve

场景重现

npm install --verbose 安装依赖的时,出现如下警告

  1. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
  2. npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
  3. npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
  4. npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
  5. npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
  6. npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64

释疑

这不是什么真的有问题,只是你的某些包依赖fsevents包,而fsevents包是MacOS系统下,在Windows/Linux下会提示警告,但不会安装.

解决办法

但是强迫症患者表示不能接受,换个角度看释疑,意味着fsevents在MacOS下是必须的,而在Windows/Linux下是可选的.

那么我们可以通过package.jsonoptionalDependencies来规避警告,然后npm install --no-optional --verbose不安装可选项即可.

参考如下:

  1. {
  2. "dependencies": {
  3. "axios": "^0.18.0",
  4. "echarts": "^4.2.0-rc.2",
  5. "element-ui": "^2.4.11",
  6. "screenfull": "^3.3.3",
  7. "vue": "^2.5.17",
  8. "vue-router": "^3.0.1",
  9. "vuex": "^3.0.1"
  10. },
  11. "devDependencies": {
  12. "@vue/cli-plugin-babel": "^3.0.5",
  13. "@vue/cli-service": "^3.0.5",
  14. "less": "^3.0.4",
  15. "less-loader": "^4.1.0",
  16. "vue-template-compiler": "^2.5.17"
  17. },
  18. "optionalDependencies": {
  19. "fsevents": "*"
  20. }
  21. }

转载于:https://my.oschina.net/taadis/blog/2988809

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号