Any way to avoid fsevents warnings? - npm

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?

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

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

Related

How to globally hide fsevents warning?

Many questions such as this one talk about this very annoying behavior on non-mac OS.
When I run npm install I want to remain aware of any warnings, but in Windows or Linux I would get this:
$ ./npm install
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/laravel-mix/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN bootstrap#4.5.0 requires a peer of jquery#1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
added 279 packages from 165 contributors, removed 4 packages, updated 2 packages and audited 1978 packages in 27.632s
Notice that most WARN are caused by fsevents which is not available outside of macOS.
Some suggest to hide every warnings with:
npm --logevel=error install
Others advise to use:
npm install --no-optional --no-shrinkwrap --no-package-lock
But all these methods does not seem right to me. I only want to execute npm install and have a configuration file that would hide all optional dependencies that are not available on my operating system.
How can I do that?
npm install --no-optional prevents this warning.

No store/index.js file in nuxt project

I make first steps in nuxtjs ander after creation of a new project I found
only store/README.md file in store subdirectory, but not
store/index.js file as I expected
Here
https://nuxtjs.org/guide/vuex-store
I read :
We don't need to install vuex since it's shipped with Nuxt.js.
I wonder can I to add vuex to my manually and how?
I tried next successfull command :
npm install --save vuex
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ vuex#3.1.2
updated 1 package and audited 10468 packages in 7.48s
found 0 vulnerabilities
But now file store/index.js anyway? Which is the right way?
Thanks!
After recreating project I found that axios was not added to my project(but I added in wizard). Also there were store, despite what I read in docs, so I had ro run :
npm install #nuxtjs/axios
...
npm install --save store
it works for me.
You have to create it in root/store/index.js

Error in adding vuetify on a project

I have created a vue-cli project.
And I tried to add vuetify but I couldn't do it
I've run: npm install vuetify --save
A error came out on terminal:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.3 (node_modules/sane/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
When I try to import vuetify on main.js it says that can't find the module.
Does anyone know how to fix/install it?
You could try using yarn, I find it sometimes performs better
install yarn
npm i -g yarn
Then install dependencies (run in your package.json file folder)
yarn
You can also do a clean install by first removing the nodes_modules folder, and then install without optional dependencies npm install --no-optional

npm packages added after uninstall dependencies

Why after calling npm uninstall I see message added packages?
For example:
$ npm uninstall -S redux-devtools-dock-monitor redux-devtools-log-monitor redux-devtools
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 115 packages and removed 22 packages in 20.589s
For that specific example at least here is some removed packages. Sometimes it just shows only added <n> packages message.
Could someone clarify it?
UPD: I did a little test from scratch but everything works as I expected when uninstall something. But I see such messages like above in question really often.

warning when executing npm install

After installation of npm (version 4.1.2 on Windows 10) I executed "npm install". But I get the following warning:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0
(node_modules\chokidar\node_modules\fsevents): npm WARN notsup
SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
Any ideas why?
The problem that the fsevents is module for OS X environment only. Probably your package.json or npm-shrinkwrap.json was created/updated on OS X and you are running npm install on a different OS, where fsevents should be omitted.