Using nvm and node 12.16.3, I am trying to update an angular application to angular 9. But it fails because one of the dependencies requires npm >= 6.11.0:
npm ERR! notsup Unsupported engine for @angular-devkit/build-angular@0.901.12: wanted: {"node":">= 10.13.0","npm":">= 6.11.0","yarn":">= 1.13.0"} (current: {"node":"12.16.3","npm":"6.5.0"})
I can't run ng
directly, because I am constantly switching between codebases that have very different node versions. So I'm running the ng update --force @angular/core@9 @angular/cli@9
command with npx
.
Even if I npm i -g npm
, npx
uses an outdated npm
version:
$ npx npm --version
6.5.0
$ npm --version
6.14.7
Unsuprisingly, this doesn't update npx npm
:
$ npx npm i -g npm
/home/user/.nvm/versions/node/v12.16.3/bin/npm -> /home/user/.nvm/versions/node/v12.16.3/lib/node_modules/npm/bin/npm-cli.js
/home/user/.nvm/versions/node/v12.16.3/bin/npx -> /home/user/.nvm/versions/node/v12.16.3/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.14.7
updated 1 package in 10.595s
$ npx npm --version
6.5.0
Why does that happen? How do I get npx
to use a more recent npm
version?