Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
922 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This has been fixed in npm v7. If you update your npm, you shouldn't see these unactionable warnings anymore.

On this GitHub question, someone confirmed that the fsevents skipping optional dependency warnings have been removed in npm v7:

Yep, it’s fixed in v7.

(source)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...