Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 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?

like image 955
Folaht Avatar asked Jun 20 '18 04:06

Folaht


People also ask

How do I remove npm warnings?

you need to change that to npm --logevel=error install , and that will suppress the WARN message and Team Foundation Server will stop complaining about it.

Can you manually edit package json?

You can add dependencies to a package. json file from the command line or by manually editing the package.


1 Answers

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)

like image 80
Shane Bishop Avatar answered Sep 28 '22 19:09

Shane Bishop