I’m having trouble updating npm.
I want to get back to a Laravel project that I put aside a few months back and realized that several components of my project would need updating so I started with that. I successfully updated Visual Studio Code to version 1.82.2, then tried to update npm with:
npm update -g
Instead of a nice clean update, I got all of this:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: '^18.17.0 || >=20.5.0' },
npm WARN EBADENGINE current: { node: 'v16.14.2', npm: '9.1.2' }
npm WARN EBADENGINE }
npm WARN deprecated @babel/[email protected]: This proposal has been
merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated @babel/[email protected]: This proposal has been merged to
the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated [email protected]: The `apollo-datasource` package is part of Apollo Server
v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: The `apollo-server-errors` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: The `apollo-server-plugin-base` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: The `apollo-server-types` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: The `apollo-server-express` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated [email protected]: The `apollo-reporting-protobuf` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 20 package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: The `apollo-server-env` package is part of Apollo Server
v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/utils.fetcher` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no
longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated [email protected]: The `apollo-server-core` package is part of Apollo Server v2 and v3, which are now deprecated (end-of-life October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.
added 236 packages, removed 111 packages, and changed 1096 packages in 14m
168 packages are looking for funding
run `npm fund` for details
npm notice
npm notice New major version of npm available! 9.1.2 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g [email protected] to update!
npm notice
I took the notice at the end to mean that I should use that command to do my npm update but got this:
PS C:Laravelvoyago02> npm install -g [email protected]
npm WARN cli npm v10.1.0 does not support Node.js v16.14.2. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Required: {"node":"^18.17.0 || >=20.5.0"}
npm ERR! notsup Actual: {"npm":"10.1.0","node":"v16.14.2"}
npm ERR! A complete log of this run can be found in: C:UsersReinhAppDataLocalnpm-cache_logs2023-09-17T21_41_20_490Z-debug-0.log
I’m really not clear what is going on here and what I need to do to get npm updated. I would appreciate some advice on how to sort this out.
2
Answers
First things first.
The message you see is just to let you know that there is an updated version available (if you are using a higher version of Node.js).
On a side note, I would recommend you to use NVM or NVS to manage different Node.js versions easily.
WARN deprecated
messages you are seeing.Your package will continue to work, but it’s good to update.
WARN EBADENGINE
means that the Node.js version you have is not compatible with the minimum Node.js version required by some package.You can try to solve this by:
v18
. You can use NVM or NVS for thisv16
Refer https://github.com/raineorshine/npm-check-updates for more details.
If you want to update NPM, you’ll have to update Node as well. That’s what it said.
If you still want to update, go to https://nodejs.org/en/download/current and get the new installer (you may choose v20, as it’s entering LTS in October)
There is a chance your package won’t build or run after update, that’d mean it’s not compatible with the latest Node and you have to install an older one.
If you want to install multiple versions of Node at once, to both have the latest features and being able to work with old stuff, you may use https://github.com/jasongin/nvs
You’ll need to
nvs add 20
to install node@20,nvs link 20
to set is as default, andnvs use 16
to use node@16 in the current shell. See docs for more info.