Is there any way to get rid of npm optional dependency warnings through editing package.json?

谁说胖子不能爱 提交于 2020-08-19 05:57:28

问题


I hate warnings.

Especially when those warnings are completely ignorable.

Most warnings I encounter are non-clean code warnings and I like to have my code clean. Other warning are actual errors.

Sometimes I miss error warnings because they were "hidden" between other warnings.

So I like to keep things clean.

Thus when I do npm install and see this:

[folatt@MyComputer ~]$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 33.232s

I want to get rid of that warning.

I know of the --no-optional argument, but that seems hacky to me as well. Isn't there anything one can do in package.json to get rid of this warning?


回答1:


You can use npm audit fix command. Also if you could share your package.json file that will be helpful



来源:https://stackoverflow.com/questions/50940423/is-there-any-way-to-get-rid-of-npm-optional-dependency-warnings-through-editing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!