npm update --save replaces ~ with ^ in package.json

59 Views Asked by At

There are two dependencies (with ~) in package.json file:

"monaco-editor": "~0.36.1",
"zone.js": "~0.11.8"

After npm update --save the dependency versions are replaced with (^):

"monaco-editor": "^0.36.1",
"zone.js": "^0.11.8"

node -v: v18.16.1
npm -v: 9.5.1

1

There are 1 best solutions below

0
On

You are hitting with https://github.com/npm/npm/issues/19585. However, you should be able to suppress with --no-save switch or re-run same command after npm config set save-prefix="" which suppresses auto-prefix.