Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Info, rather than Warn, when skipping packages not suitable to target OS #11632

Closed
mikemaccana opened this issue Feb 22, 2016 · 64 comments
Closed

Comments

@mikemaccana
Copy link
Contributor

Per #10768, many users are confused by the message NPM shows when skipping packages not relevant to target OS:

Currently:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.7

Suggest:

npm INFO optional Skipping optional dependency /chokidar/fsevents:
npm INFO notsup Not compatible with your operating system or architecture: fsevents@1.0.7

I.e, remove the word 'failed' and use 'INFO' instead of 'WARN'

@bendavis78
Copy link

This should really be a DEBUG level message and not shown at all by default. If an optional dependency isn't meant for my OS, there's no reason I need to know about it. The way the error message is written, it still looks like an error. Plus, npm already doesn't tell me whether or not install was successful, so when I get any output from npm my first reaction is to think it's an error.

@simonbuchan
Copy link

I'm fine with this being a WARN if it's only shown when it would be installed if it was supported:

$ npm i -S glob
test-npm@ C:\code\test-npm
`-- glob@7.0.3
  <snip>
$ npm i

Yay, no output when nothing happened!

$ npm i -S chokidar
test-npm@ C:\code\test-npm
`-- chokidar@1.5.0
  <snip>
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12

OK, it tried and failed to install something, that's reasonable.

$ npm i
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12

Boo! It did nothing, nothing has changed, there's no reason to complain!

$ npm i -S object-assign
test-npm@ C:\code\test-npm
`-- object-assign@4.1.0

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12

Boo! object-assign installed fine and problem free, there shouldn't be a warning!

I suggest adding, for a strawman, _failedDependencies.fsevents: "1.0.12" to node_modules/chokidar/package.json so npm knows at least not to message again, and maybe it can know to not bother trying to install again.

@jods4
Copy link

jods4 commented May 24, 2016

+1
This should be given a higher priority (the problem exists at least since Dec 2015), especially since it's a trivial fix.

This is not just a semantic / nitpicker question. Using WARN rather than INFO triggers some downstream tooling errors, see the issue Kukkimonsuta linked above. It is highly annoying to see a yellow warning sign in your tools when everything is OK. Moreover, you end up ignoring it, which may hide other issues.

@Vanuan
Copy link

Vanuan commented Jun 7, 2016

Is is possible to tell npm to stop downloading that package?

npm info attempt registry request try #1 at 8:48:59 PM
npm http request GET https://registry.npmjs.org/fsevents

It happens on every npm install even though it's already cached.

@gigablox
Copy link

gigablox commented Jun 7, 2016

Yea this is super obnoxious from a devops perspective. WARN's usually mean I need to investigate something and now I'm deviating build script code to let these types of exceptions run by.

@Vanuan
Copy link

Vanuan commented Jun 30, 2016

The problem here is the http fetch, not the warning itself.

Some people suggest using npm install --no-optional.

@LufoX11
Copy link

LufoX11 commented Aug 6, 2016

This should really be a DEBUG level message and not shown at all by default. If an optional dependency > isn't meant for my OS, there's no reason I need to know about it. The way the error message is written, it > still looks like an error.

100% right. I'm here because I thought it was an error.

@Vanuan
Copy link

Vanuan commented Aug 6, 2016

There is a reason. Otherwise you wouldn't know why npm install is so slow. Even if you already run it.

@jods4
Copy link

jods4 commented Aug 7, 2016

@Vanuan

The problem here is the http fetch, not the warning itself.

Reading the OP again, I really think this issue is about reporting WARN vs INFO.
Maybe you need to open another issue if you have trouble with the http fetch.

And I really wish someone would do something about this! 😡 I really don't like ignoring all warnings when I run my toolchain, it makes me feel that one day I'll have a real problem.

@Vanuan
Copy link

Vanuan commented Aug 7, 2016

it makes me feel that one day I'll have a real problem.

But you do have a real problem. If you want to ignore optional dependencies, use --no-optional

@jods4
Copy link

jods4 commented Aug 7, 2016

@Vanuan Sorry but I don't get you.
fsevents is the implementation strategy of chokidar on Mac OS-X, using FSEvents native API.
I run on Windows, where Chokidar uses another strategy. Where is my real problem?

If you want to ignore optional dependencies, use --no-optional

What if I don't want to ignore all of them? Imagine there is an optional package to use Windows native file watchers, you're telling me that I can't use it?

What if I can't control that flag? As others have mentioned before, npm is called by other tools, like Visual Studio.

In the end, the problem is that NPM doesn't follow what is generally considered an ERROR vs a WARNING vs an INFO. And it would be nice to fix it.

@Vanuan
Copy link

Vanuan commented Aug 8, 2016

I agree, that --no-optional is not a best workaround. But hiding a problem is a poor one.

The proper workaround would be that npm somehow remembers which optional dependency installs have already failed and skips trying reinstalling them. We'd still have a warning on the very first npm install as package.json format doesn't support platform-specific dependencies, and optional dependencies are being abused.

The solution would be to add support of platform-specific dependencies.

@rodriguezmilton
Copy link

Hi there !
I totally agree with @jods4.
The best workaround I found is going back to previous versions and wait for npm to solve this problem. I think it's better than --no-optional.
Let's wait for them to fix it soon :)

@rjgotten
Copy link

rjgotten commented Aug 18, 2016

The proper workaround would be that npm somehow remembers which optional dependency installs have already failed and skips trying reinstalling them. We'd still have a warning on the very first npm install as package.json format doesn't support platform-specific dependencies, and optional dependencies are being abused.

And on that very first npm install we'd still have downstream tooling break when a warning is output over stderr. So no; that's not a proper workaround.

The correct workaround is to either stop treating errors in optional dependencies as warnings, or to stop outputting warnings on stderr and only report actual errors there.

@Vanuan
Copy link

Vanuan commented Aug 18, 2016

Ok. So there are the following subissues caused by platform (in)compatibility:

  1. CI use case (tooling can't ignore a specific warning)

  2. Developer use case

    a. developers are confused
    b. npm install is longer than needed

Workaround to the first issue is to patch your tooling

@rjgotten
Copy link

Workaround to the first issue is to patch your tooling

Which is a no-go in case of closed source tooling. E.g. Visual Studio.

@jods4
Copy link

jods4 commented Aug 18, 2016

Workaround to the first issue is to patch your tooling

LOL, seriously? Workaround to NPM raising warnings when they are meaningless is to patch all the tools?
What about patching NPM instead?

@Vanuan
Copy link

Vanuan commented Aug 18, 2016

That's a difference between workaround and solution.

Which is a no-go in case of closed source tooling. E.g. Visual Studio.

change your tooling? :)

@rjgotten
Copy link

change your tooling? :)

You're right. We should all ditch NPM as a package manager and look for a better alternative...

@isdzulqor
Copy link

I got this error too when want to install npm install html-webpack-plugin --save-dev
coba

npm install --no-optional not working. I am using npm version 3.10.3. any solution guys?
thank you

@glen-84
Copy link

glen-84 commented Aug 28, 2016

@isdzulqor You can ignore the warnings. This issue is about changing the log level from WARN to INFO (or, better yet, DEBUG, so that they won't even show up by default).

@watilde
Copy link
Contributor

watilde commented Jun 30, 2017

I opened PR: #17530.

There is one thing I changed with the original proposal in my pull request. We have log.info for sure but it doesn't display INFO anymore, so I replaced info with notice.

@jods4
Copy link

jods4 commented Jul 14, 2017

BTW Yarn just fixed this. In their next release this "warning" will be info.
Meanwhile, npm still doesn't care -- even closes the issue -- although it's their top voted issue.

If you can you should switch from NPM to Yarn, it's better in pretty much every regard: speed, determinist install, offline mode, lock file by default, yarn run local packages (yeah -- just released npx, too late for me).

@akvadrako
Copy link

This issue should be reopened and fixed.

@mikemaccana
Copy link
Contributor Author

Confirmed this is fixed in yarn 1.0.1:

info fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.

@whitneyland
Copy link

whitneyland commented Oct 8, 2017

BTW Yarn just fixed this. In their next release this "warning" will be info.
Meanwhile, npm still doesn't care -- even closes the issue -- although it's their top voted issue.

If you can you should switch from NPM to Yarn, it's better in pretty much every regard: speed,
determinist install, offline mode, lock file by default, yarn run local packages (yeah -- just released npx,
too late for me).

@jods4 Interesting response from the NPM team, considering that community feedback is such a powerful tool to maintain momentum of success. Proactively responding to feedback is usually required to prevent projects from slowly losing relevance, or even eventually failing.

I’ll tell you this, I may have projects that fail, but if they do I guarantee it will never happen for some straightforward issue that is being held up in front of my face by the community.

Btw, thanks for the yarn recommendation. It seems to work great as a drop in replacement with no hassles.

@mborysenko
Copy link

mborysenko commented Dec 9, 2017

Today have updated the npm till the 5.6.0 version and now I'm getting ERR instead of WARN while installing the react-redux package. Some of the dependencies in my project have a dependency on a chokidar. Before I could just ignore that warning but now my builds are failing. --no-optional parameter doesn't help

D:\dev\styles-demo>npm install react-redux@latest --save --no-optional
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@1.1.3: 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

Question: why npm tries to install something that is considered as optional(is installed in defined conditions) or should be installed on a certain platform? Shouldn't it skip it if does not meet conditions?

@mborysenko
Copy link

mborysenko commented Dec 9, 2017

D:\projects\styles-demo>npm install react-redux@latest --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\browser-sync\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack-env\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Message when npm of version 5.5.1 is used

@gaearon
Copy link

gaearon commented Dec 9, 2017

It's probably better to file a separate bug report for this.
Maintainers typically don't read closed issues.

@YasharF
Copy link

YasharF commented Dec 29, 2017

New PR: #19198

@shane-reaume
Copy link

@gaearon So this was fixed? I still get errors so maybe we should re-open?

@jeffvandyke
Copy link

Yes, this absolutely should be re-opened. It's labeled and clear, PR #19198 is not merged yet, this issue is clear, and Linux and Windows people have been seeing that wretched npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents... for years now whenever at least webpack is installed. Still semi-optimistic for a WARN-free npm install on popular projects though...

@YasharF
Copy link

YasharF commented Jan 31, 2018

In case if anyone is looking for the current state of the issue and haven't had a chance to read all of the related GitHub issues and pull requests, here is a summary:

The current "open" ticket for this problem seems to be: #17466
The current PR for resolving this is: #19198

Historically from what I gathered:

I know this history list is long and perhaps a sign that some process improvement may be needed, but this is where we are now. Again:

The current "open" ticket for this problem seems to be: #17466
The current PR for resolving this is: #19198

@vandyw95
Copy link

Y'all gonna face a problem in the future if y'all ignore the "WARN".
Please read it here #19198 as how this impact my company apps and of course wasting my time to refactor that done nothing good to fix the bug.
WARN works as it does. It doesn't mean that if your app is fine you can just ignore. It is NOT no problem but it IS a problem but you just don't know it yet because it hasn't happened yet.

@vandyw95
Copy link

@YasharF -1 for any reason?
Is it wrong if it "WARN"? Because I got more trouble by looking at it only as a (read: ignore) "WARN" not "ERROR", and lower it to "INFO" rather than "WARN"?

@YasharF
Copy link

YasharF commented Feb 13, 2018

@vandyw95 you haven't read the discussions and commenting on a closed github issue.

@vandyw95
Copy link

@YasharF discussions which point to this one in conclusion >> remove the word 'failed' and use 'INFO' instead of 'WARN'
And this the reason of my comment about changing "WARN" to "INFO".
And I had read the discussions. If commenting here is wrong why don't you point out your thought here? :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.