3

Trying to get into react, using npm and such, and I often get these types of warnings:

> npm install axios redux react-redux redux-thunk react-router-dom validator redux-form
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.6 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ redux-thunk@2.3.0
+ validator@10.11.0
+ axios@0.18.0
+ react-router-dom@5.0.0
+ redux@4.0.1
+ react-redux@7.0.2
+ redux-form@8.2.0
added 30 packages from 100 contributors and audited 878734 packages in 23.247s
found 0 vulnerabilities

Apparently I can just ignore them, but I'm just curious if there's a way to not get these warnings? Configure npm somehow? Adding something to package.json? A flag somewhere?

Svish
  • 152,914
  • 173
  • 462
  • 620

2 Answers2

0

You can silence the npm WARN upon installation by specifying what types of errors you want to see.

You can run npm --logevel=error install.

By using --loglevel=error you will only see npm ERROR and ignore any WARN

Nicholas Porter
  • 2,588
  • 2
  • 23
  • 37
  • 1
    That would require adding that flag every time I run `install`, right? And also, would hide _all_ warnings, not just this one? So, would work, but a bit more manual and aggressive than I'm hoping for. – Svish Apr 25 '19 at 18:49
-1

It's a warning, due to the operating system. fsevents run on mac os environment but in windows, it works as optional dependencies that are the reason behind your warning after all its not an error. you can use https://github.com/paulmillr/chokidar instead of fsevents.

The problem relates to the "shrinkwrap" or package-lock.json which gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.

Adding these options to the npm install command should allow packages to install again.

   --no-optional argument will prevent optional dependencies from being installed.



--no-shrinkwrap argument, which will ignore an available package lock or
                   shrinkwrap file and use the package.json instead

.

--no-package-lock argument will prevent npm from creating a package-lock.json file. The complete command looks like this:

 npm install --no-optional --no-shrinkwrap --no-package-lock

you can look into following answer npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14

ANIK ISLAM SHOJIB
  • 3,002
  • 1
  • 27
  • 36