npm WARN deprecated xxx: what should I do? - node.js

I've been using grunt from a couple years now, and it's been like forever i've been seeing warnings like the following:
npm WARN deprecated win-spawn#2.0.0: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
npm WARN deprecated lodash#0.9.2: lodash#<2.0.0 is no longer maintained. Upgrade to lodash#^3.0.0
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash#2.2.1: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
my projects actually work anyway, even with these warnings. lodashis generally the one always giving me warnings, since day one.
here's the package.json file producing these errors:
{
"name": "xxx",
"version": "0.1.1",
"devDependencies": {
"autoprefixer": "^6.2.3",
"cssnano": "^3.4.0",
"grunt": "^0.4.5",
"grunt-browser-sync": "^1.5.3",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-htmlmin": "^0.6.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-sass": "~0.7.4",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-critical": "^0.2.0",
"grunt-delete-sync": "0.0.2",
"grunt-newer": "^0.7.0",
"grunt-postcss": "^0.7.1",
"grunt-processhtml": "^0.3.13"
}
}
I guess some module or dependency is outdated but...
1) why is it still working? is it safe to ignore the warnings?
2) how do I know which module is outdated and what should i do about it?

Deprecated means it's not further developed, but also it won't change ever again. If a module relies on a deprecated package which has a bug the only way to solve is to upgrade the dependency. But as nothing changes it will work as it was working all the time.

Related

npm install giving Error after so many WARN

My ReactJS project was working all fine till last week but from Sunday its giving below error on npm install:
PS C:\Projects\Interface\ClientApp> npm install
npm WARN deprecated material-ui-icons#1.0.0-beta.36: Use #material-ui/icons instead
npm WARN deprecated material-ui#0.20.2: You can now upgrade to #material-ui/core
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 popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core,
this package is dedicated to the legacy v1
npm WARN deprecated material-ui-pickers#2.2.4: You can now upgrade to
#material-ui/pickers. Documentation for v2 can be found at
https://material-ui-pickers-v2.dmtr-kovalenko.now.sh/
npm WARN deprecated extract-text-webpack-plugin#3.0.2: Deprecated. Please use
https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated fsevents#1.1.2: fsevents 1 will break on node v14+ and could
be using insecure binaries. Upgrade to fsevents 2.
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 left-pad#1.3.0: use String.prototype.padStart()
npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading
Browserslist >3.0 config used in other tools.
npm WARN deprecated sw-precache#5.2.1: Please migrate to Workbox:
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated chokidar#1.7.0: Chokidar 2 will break on node v14+.
Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated sw-toolbox#3.6.0: Please migrate to Workbox:
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
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 hawk#3.1.3: This module moved to #hapi/hawk. Please make sure to
switch over as this distribution is no longer supported and may contain
bugs and critical security issues.
npm WARN deprecated request#2.81.0: request has been deprecated,
see https://github.com/request/request/issues/3142
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 request#2.88.2: request has been deprecated, see
https://github.com/request/request/issues/3142
npm WARN deprecated os-homedir#2.0.0: This is not needed anymore.
Use `require('os').homedir()` instead.
npm WARN deprecated browserslist#1.7.7: Browserslist 2 could fail on reading
Browserslist >3.0 config used in other tools.
npm WARN deprecated circular-json#0.3.3: CircularJSON is in maintenance only,
flatted is its successor. npm WARN deprecated hoek#2.16.3: This version
has been deprecated in accordance with the hapi support policy (hapi.im/support).
Please upgrade to the latest version to get the best features, bug fixes,
and security patches. If you are unable to upgrade at this time, paid
support is available for older versions (hapi.im/commercial).
npm WARN deprecated cryptiles#2.0.5: This version has been deprecated in accordance
with the hapi support policy (hapi.im/support). Please upgrade to the
latest version to get the best features, bug fixes, and security patches.
If you are unable to upgrade at this time, paid support is available for
older versions (hapi.im/commercial).
npm WARN deprecated boom#2.10.1: This version has been deprecated in accordance
with the hapi support policy (hapi.im/support). Please upgrade to the
latest version to get the best features, bug fixes, and security patches.
If you are unable to upgrade at this time, paid support is available for
older versions (hapi.im/commercial).
npm WARN deprecated sntp#1.0.9: This module moved to #hapi/sntp. Please make sure
to switch over as this distribution is no longer supported and may contain
bugs and critical security issues.
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 ERR! Unexpected end of JSON input while parsing near '...on" : "10.16.3"
npm ERR! }'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\AppData\Roaming\npm-cache\_logs\2020-07-06T10_18_35_852Z-debug.log
Note
I have upgraded the npm from 6.9.0 to 6.14.5 then also facing same issue
I have removed package.json.lock and node_modules then also facing same issue
Please do let me know what else I am missing ?
--------------My package.json--------------
{
"name": "clientapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^4.9.5",
"#material-ui/icons": "^4.4.1",
"#material-ui/lab": "^4.0.0-alpha.45",
"#material/typography": "^3.1.0",
"#trendmicro/react-sidenav": "^0.4.5",
"axios": "^0.19.0",
"bootstrap": "^3.4.1",
"flux": "^3.1.3",
"jquery": "^3.4.1",
"match-sorter": "^4.0.2",
"material-grid": "^0.1.0",
"material-table": "^1.54.2",
"material-ui": "^0.20.2",
"material-ui-colors": "^1.0.0",
"material-ui-icons": "^1.0.0-beta.36",
"mdbreact": "^4.22.0",
"oidc-client": "^1.5.4",
"plotly.js": "^1.49.4",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-bootstrap": "^0.31.5",
"react-bootstrap-tabs": "^1.0.2",
"react-dom": "^16.13.0",
"react-flippy": "^0.1.5",
"react-loader-spinner": "^3.1.5",
"react-minimal-pie-chart": "^6.0.1",
"react-plotly.js": "^2.3.0",
"react-redux": "^7.1.3",
"react-redux-loading-bar": "^4.5.0",
"react-router-bootstrap": "^0.24.4",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
"react-slideshow-image": "^1.4.0",
"react-sortable-tree": "^2.7.1",
"react-stack-grid": "^0.7.1",
"react-stonecutter": "^0.3.10",
"react-table": "^7.0.0-rc.15",
"react-web-tabs": "^1.0.1",
"redux": "^4.0.4",
"rimraf": "^2.6.2",
"webpack": "*"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
}
If you see the log, for old packages, it gives a Warning and not an Error. The error is actually this line: npm ERR! Unexpected end of JSON input while parsing near '...on" : "10.16.3"
npm ERR!}'
Since you have not included the entire log, with this, I can guess it is possibly an ambiguity issue due to references not properly resolved!
Open command prompt/powershell/terminal, etc. with admin privilege. Do as below: -
sudo npm cache clean --force
sudo npm cache verify
Delete the package-lock.json file located in C:\Users\<your_username>
Try installing your project dependencies now from your project folder with npm i.
Note: - If this doesn't work, follow the same process as above (again) and uninstall the npm and node and reinstall it. It should work then!
Try upgrading to #material-ui/core.
material-ui package is deprecated.

Not able to install react-dom for react version v0.13.x

I am getting following error when I am trying to run the command npm install react react-dom
npm install react react-dom
- base62#1.2.0 node_modules/base62
- esprima-fb#15001.1.0-dev-harmony-fb node_modules/jstransform/node_modules/esprima-fb
- object-assign#2.1.1 node_modules/jstransform/node_modules/object-assign
- source-map#0.4.4 node_modules/jstransform/node_modules/source-map
- jstransform#11.0.3 node_modules/jstransform
- envify#3.4.1 node_modules/envify
/prd/dir/UI
├─┬ UNMET PEER DEPENDENCY react#16.2.0
│ └── fbjs#0.8.16
└─┬ UNMET PEER DEPENDENCY react-dom#16.2.0
└── fbjs#0.8.16
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.1.3
npm WARN enoent ENOENT: no such file or directory, open '/prd/dir/UI/package.json'
npm WARN react-simple-dropdown#3.2.0 requires a peer of react#0.14.x || 15.x but none was installed.
npm WARN react-simple-dropdown#3.2.0 requires a peer of react-dom#0.14.x || 15.x but none was installed.
npm WARN reflux#0.2.13 requires a peer of react#>=0.12.2 <0.15.0 but none was installed.
npm WARN UI No description
npm WARN UI No repository field.
npm WARN UI No README data
npm WARN UI No license field.
npm ERR! code 1
Follow are my dev dependencies:
"devDependencies": {
"babel-core": "^5.8.25",
"babelify": "^6.1.x",
"browser-sync": "^2.7.13",
"browserify": "^10.2.6",
"debowerify": "^1.3.1",
"del": "^1.2.0",
"eslint-plugin-react": "^3.6.3",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-if": "^1.2.5",
"gulp-imagemin": "^2.3.0",
"gulp-notify": "^2.2.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.0.x",
"gulp-sourcemaps": "^1.5.2",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.6",
"history": "^1.12.5",
"humps": "^0.6.0",
"lodash": "^3.10.0",
"react": "^0.13.x",
"react-document-title": "^1.0.2",
"react-router": "^1.0.0-rc1",
"reflux": "^0.2.9",
"run-sequence": "^1.1.1",
"superagent": "^1.2.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.2.x"
}
In order to install a specific version of the npm package, you can mention the version at the end like
npm install -S react#0.13.x
However, I would highly recommend you to go with the latest versions. Also React-DOM was created as a separate package only from version 0.14.0 and hence is not needed before that. Check this answer react vs react DOM confusion

Update Angular2 to latest version

I am trying to update Angular2 to the latest version release candidate 4.
I have executed npm outdated and edited accordingly the package.json file.
Then I have executed npm update which failed. I haven't saved the error message. In the following I googled and tried several different npm commands. Unfortunately I cannot recall them.
The current status is, that npm update does not show anything; so seems to work.
The command npm start starts the server, but the browser console displays multiple errors. The first is:
http://localhost:3000/node_modules/#angular/platform-browser-dynamic/platform-browser-dynamic.umd.js Failed to load resource: the server responded with a status of 404 (Not Found)
Besides npm install shows the following warnings:
typings WARN deprecated 2016-06-02: "registry:dt/core-js#0.0.0+20160317120654" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/node#4.0.0+20160509154515" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/jasmine#2.2.0+20160505161446" is deprecated (updated, replaced or removed)
├── core-js (global)
├── jasmine (global)
└── node (global)
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN optional Skipping failed optional dependency /lite-server/browser-sync/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN #angular/core#2.0.0-rc.4 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/http#2.0.0-rc.4 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/router#3.0.0-beta.2 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/core#2.0.0-rc.1 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/common#2.0.0-rc.1 but none was installed.
npm WARN #angular/router-deprecated#2.0.0-rc.1 requires a peer of #angular/platform-browser#2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api#0.0.14 requires a peer of rxjs#5.0.0-beta.6 but none was installed.
The package.json relevant parts are currently:
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.2",
"#angular/upgrade": "2.0.0-rc.4",
"angular2-in-memory-web-api": "0.0.14",
"angular2-uuid": "^1.0.7",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.9",
"systemjs": "0.19.31",
"zone.js": "^0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"canonical-path": "0.0.2",
"http-server": "^0.9.0",
"tslint": "^3.7.4",
"lodash": "^4.11.1",
"jasmine-core": "~2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"karma-cli": "^1.0.1",
"karma-htmlfile-reporter": "^0.3.4",
"karma-jasmine": "^1.0.2",
"protractor": "^3.3.0",
"rimraf": "^2.5.2"
},
Follow these steps:
Delete node_modules folder.
Take latest package.json from https://angular.io/guide/quickstart
Run 'npm install' command.
In typings.json one must update to new registry value, if problem shows up for core-js
"core-js": "registry:dt/core-js#0.0.0+20160317120654"
to
"core-js": "registry:dt/core-js#0.0.0+20160725163759"
https://github.com/mgechev/angular2-seed/commit/8a8c64e0e8b18cd0c19c1ab2f1dc71a30bbd6174
This might be outdated but your typings were never addressed. Given that you would want to always keep them up to date. Also for anyone else seeking to know about the update process
Here is how you could update/reinstall them
Example:
For your node to update it simply type
typings install dt~node --save --global
The following will update your node typings which would be in /typings/global/node
If you did not have node the same command would suffice and your index.d.ts will also be update with a new entry!

Npm peer dependency error

I am getting the npm peer dependency error repeatedly with npm install command . This is my package.json on which i have unmet peer dependency on react and webpack
npm WARN react-datepicker#0.25.0 requires a peer of react#^0.14.0 but none was installed.
npm WARN babel-loader#6.2.4 requires a peer of webpack#1 || ^2.1.0-beta but none was installed.
npm WARN desktop-react#1.0.0 No repository field.
npm WARN desktop-react#1.0.0 license should be a valid SPDX license expression
{
"name": "xxxxxxxxx",
"version": "x.x.x",
"description": "",
"main": "index.js",
"author": "",
"license": "xxxxxxx",
"dependencies": {
"bootstrap": "^3.3.6",
"fs": "0.0.2",
"history": "^1.17.0",
"immutable": "^3.8.1",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.11.1",
"moment": "^2.13.0",
"react": "^15.0.1",
"react-autosuggest": "^3.7.3",
"react-bootstrap": "^0.29.1",
"react-datepicker": "^0.25.0",
"react-dom": "^15.0.1",
"react-redux": "^4.4.5",
"react-router": "^2.3.0",
"react-select": "^1.0.0-beta12",
"redux": "^3.5.2"
},
"devDependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"bootstrap": "^3.3.6",
"css-loader": "^0.23.1",
"redux-devtools": "^3.2.0",
"style-loader": "^0.13.1"
}
}
Well, firstly, those aren't errors, they're warnings. They won't actually stop your code from running, they're just there to give you a heads up if there's something wrong with your dependencies.
Effectively, peerDependencies are a way for packages to specify, "to use me, you should also have x version of y package installed". In your case, you have two issues:
That version of react-datepicker expects you to be using React 14, but you have React 15. If you update react-datepicker to the newest version, that one will be compatible with v15 - that said, there were very few breaking changes between those two version of React if I remember correctly, so if you're stuck using that particular version of the date picker for some reason, it should be safe to ignore that warning. Your mileage may vary, though.
babel-loader relies on Webpack, but you don't have any version of it installed. This does seem like a mistake on your part; run npm install webpack --save-dev and that should go away.
Hopefully with that context you'll be able to understand how to interpret those warnings in the future!
There are warnings, not errors, but it's still worthwhile to fix.
react-datepicker: you should upgrade to the latest version (0.27.0), which declares react#^15.0.0 as a peer dependency.
babel-loader: the installation instructions explain that with npm#3 you need to declare peer dependencies (like webpack) explicitly in your package.json (using npm i webpack --save-dev).
The desktop-react warnings can be ignored.

npm install not reading package.json

not sure what's going on but I have a box running on ubuntu through digital ocean and just cloned my git repo. I have a package.json that is correctly formatted (I've used it before) with ~20 dependencies.
the current dir where I cloned has chmod777 and when I
sudo npm install
It starts installing packages but node_modules doesn't get created nor do any of my node dependencies get pulled in from my package.json and there's a killed log at end of install attempt
Is there anywhere I can begin to debug this? I'm running the latest npm version (3.8.8) and node 5.8
edit: here's the output of npm install
npm WARN deprecated graceful-fs#3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash#0.10.0: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated wrench#1.4.4: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated graceful-fs#1.1.14: graceful-fs v3.0.0 and before will fail on node releases >= v6.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated jade#1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
extract:winston → gunzTar ▄ ╢█████████████████████████████████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
Killed
and here's my package.json
{
"name": "app",
"version": "1.0.0",
"main": "server.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.10.2",
"bower": "~1.4.1",
"cheerio": "~0.20.0",
"connect-mongo": "latest",
"cookie-parser": "latest",
"express": "latest",
"express-session": "latest",
"growl": "~1.8.1",
"grunt": "~0.4.5",
"grunt-bower-task": "~0.4.0",
"grunt-contrib-concat": "~1.0.0",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-sass": "~1.0.0",
"grunt-contrib-uglify": "~1.0.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-html2js": "~0.3.2",
"grunt-notify": "~0.4.1",
"grunt-script-link-tags": "^1.0.2",
"log4js": "~0.6.33",
"method-override": "~2.0.2",
"moment": "^2.12.0",
"mongoose": "~4.4.7",
"npm": "^3.8.6",
"passport": "latest",
"passport-openid": "latest",
"request": "latest",
"socket.io": "~1.4.5",
"socket.io-client": "^1.4.5",
"time-grunt": "~1.2.1",
"winston": "^2.2.0"
}
}
I think it's the memory running out. you can look at /var/log/syslog to find out if it was node. found here: what can cause nodejs to print killed and exit.
or try adding a swap file.

Resources