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.
Related
$ npm install axios
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\User\package.json'
npm WARN #babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining#7.13.12 requires a peer of #babel/core#^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.21.0 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN User No description
npm WARN User No repository field.
npm WARN User No README data
npm WARN User No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\fetch\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":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\fetch\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":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ axios#0.21.1
updated 1 package and audited 2040 packages in 67.534s
135 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
You should run npm install axios from the folder where is located your package.json file. Be sure to move in the root of your project before running npm install
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.
For date formatting I tried downloading date-fns through: npm install date-fns --save
Installation failed and I got following warnings and errors:
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated babel-preset-expo#8.1.1: 8.1.1 mistakenly contains the contents of 8.2.1; use that version instead
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
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 WARN deprecated intl-relativeformat#2.2.0: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#migration-guide'
npm WARN deprecated #hapi/joi#15.1.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated deep-assign#3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN rm not removing C:\Users\kanch\Documents\ReactNative\confusion\node_modules\.bin\rimraf.cmd as it wasn't installed by C:\Users\kanch\Documents\ReactNative\confusion\node_modules\rimraf
npm WARN rm not removing C:\Users\kanch\Documents\ReactNative\confusion\node_modules\.bin\rimraf as it wasn't installed by C:\Users\kanch\Documents\ReactNative\confusion\node_modules\rimraf
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\metro\node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\metro-core\node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\metro\node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN react-native-elements#2.0.2 requires a peer of react-native-vector-icons#>6.6.0 but none is installed. You must install peer dependencies yourself.
npm ERR! Maximum call stack size exceeded
After that I left it there and saved the application without formatting the date and tried running yarn start, to which I get this output:
throw err;
^
Error: Cannot find module 'nice-try'
Require stack:
- C:\Users\kanch\Documents\ReactNative\confusion\node_modules\expo\node_modules\cross-spawn\lib\parse.js
- C:\Users\kanch\Documents\ReactNative\confusion\node_modules\expo\node_modules\cross-spawn\index.js
- C:\Users\kanch\Documents\ReactNative\confusion\node_modules\expo\bin\cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (C:\Users\kanch\Documents\ReactNative\confusion\node_modules\expo\node_modules\cross-spawn\lib\parse.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\kanch\\Documents\\ReactNative\\confusion\\node_modules\\expo\\node_modules\\cross-spawn\\lib\\parse.js',
'C:\\Users\\kanch\\Documents\\ReactNative\\confusion\\node_modules\\expo\\node_modules\\cross-spawn\\index.js',
'C:\\Users\\kanch\\Documents\\ReactNative\\confusion\\node_modules\\expo\\bin\\cli.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I am unable to start Metro server and can't find nice-try in my node_modules. Any solutions to this?
Have you tried deleting node_modules and package-lock.json and then npm install?
dev#1d821be6e48f:~/project$ npm i
npm WARN #ngtools/webpack#7.2.1 requires a peer of #angular/compiler-cli#>=5.0.0 <8.0.0 || ^7.0.0-beta.0 but none is installed. You must install peer dependencies yourself.
npm WARN css-loader#2.1.0 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#2.29.0 requires a peer of typescript#>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.6 (node_modules/#angular-devkit/build-angular/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.6 (node_modules/#angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.6 (node_modules/#angular/compiler-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1 package from 1 contributor, moved 1 package and audited 37762 packages in 7.365s
found 0 vulnerabilities
I see that package.json HAS typescript and #angular/compiler-cli. I dont't get NPM logs... What am i missing?
Here is piece of package.json
"devDependencies": {
"#angular/compiler-cli": "^7.2.0",
"typescript": "~3.2.2"
}
How to translate this? typescript#>=2.1.0 I can't find any good docs concerning version ranges...
Why WARN messages are appearing?
try the below command on cmd
npm install -g angular-cli#7.2.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