Change npm default caret(^) in package.json

You should use double quotes to escape the prefix properly:

npm config set save-prefix="^"

On windows10 (npm v. 3.8.6) I had to omit the quotes by using below command:

npm config set save-prefix=~

npm config set save-prefix='~' sets your default back to tilde

npm config set save-prefix='' will remove the auto-prefixing


If npm config set save-prefix='~' is not doing anything, it's because save-exact is set to true, thus overwriting it. So in that case, enter the following steps in terminal:

  1. npm config set save-exact=false
  2. npm config set save-prefix='~', or to whichever save-prefix value you like.

You can confirm that all those changes are saved by entering npm config list.

Tags:

Node.Js

Npm