How to globally hide fsevents warning? - npm

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.

Related

ngx-admin issues on Ubuntu

Fresh install of Ubuntu 20.x, npm and node on the latest version. Getting these errors:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/#angular/compiler-cli/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.13 (node_modules/webpack-dev-server/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#2.1.3 (node_modules/watchpack/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.13 (node_modules/watchpack-chokidar2/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#2.1.3 (node_modules/sass/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#2.1.3 (node_modules/rollup/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.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"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/karma/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"})
added 2602 packages from 1488 contributors and audited 2686 packages in 196.679s
63 packages are looking for funding
run npm fund for details
found 140 vulnerabilities (88 low, 5 moderate, 45 high, 2 critical)
run npm audit fix to fix them, or npm audit for details
How to fix it?
This behaviour is common when cloning a repo from github. Several packages have vulnerabilities and are not up-to-date. The 140 vulnerabilities include packages that are for production and development.
To check for vulnerabilities for production:
npm audit --production
To fix vulnerabilities for production:
npm audit fix --production
To fix every issue you can use npm audit fix, but be aware that some dependencies can be broken.

Tried to install react-navigation , and it says following. how can i fix these errors ? npm audit fix did not work

chamika#chamika-MS-7817:~/Documents/React Native Projects/navi$ npm install react-navigation
npm WARN #react-native-community/masked-view#0.1.5 requires a peer of react-native#^0.57 but none is installed. You must install peer dependencies yourself.
npm WARN #typescript-eslint/eslint-plugin#2.15.0 requires a peer of #typescript-eslint/parser#^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#5.1.0 requires a peer of #typescript-eslint/parser#2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#5.1.0 requires a peer of eslint#6.x but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-stack#2.0.10 requires a peer of react-native-safe-area-context#^0.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/react-scripts/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/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
react-navigation#4.0.10
updated 1 package and audited 1858915 packages in 11.492s
35 packages are looking for funding
run npm fund for details
found 4 low severity vulnerabilities
run npm audit fix to fix them, or npm audit for details
These are not errors, they are just warnings that you need to install the sub-dependencies of the given package yourself. React Navigation is installed successfully in this case and you can use it fine. You can try doing npm audit fix which will try to fix these warnings by installing the dependencies.

Any way to avoid fsevents warnings?

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

can't upgrade from webpack 3 to 3.12.0

I'm trying to use a node package which requires a higher version of webpack than I have installed.
My packages.json file is here.
When I try to install:
npm install webpack#3.12.0
I get the following error:
$ npm install webpack#3.12.0
app#1.0.0 /home/ubuntu/workspace
└── UNMET PEER DEPENDENCY webpack#3.12.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.1.2 (node_modules/watchpack/node_modules/chokidar/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"})
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.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN eonasdan-bootstrap-datetimepicker#4.17.47 requires a peer of bootstrap#^3.3 but none was installed.
npm WARN extract-text-webpack-plugin#2.1.2 requires a peer of webpack#^2.2.0 but none was installed.
npm ERR! code 1
I had the same issue, but it was resolved by following the instructions stated by Vu Huu Cuong:
rm -rf node_modules/
npm cache clean
npm install

react-native -cli installation error

I'm trying to install react-native-cli by using the following command:
C:\WINDOWS\System32>npm install -g react-native -cli
and I'm getting the following errors, can someone help on this matter?
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\react-native -> D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\node_modules\react-native\local-cli\wrong-react-native.js
npm WARN react-native#0.54.0 requires a peer of react#^16.3.0-alpha.1 but none is installed. You must install peer dependencies yourself.
npm WARN #babel/plugin-check-constants#7.0.0-beta.38 requires a peer of #babel/core#7.0.0-beta.38 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\react-native\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"})