Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change npm default caret(^) in package.json

Tags:

node.js

npm

How do I change the default prefix character (^) that npm inserts in package.json when I run npm install --save package?

like image 696
Jondlm Avatar asked Aug 21 '14 17:08

Jondlm


People also ask

What is caret symbol in package json?

Caret (^) notation: It is used for automatically updating the minor updates along with patch updates. Example: The ^1.2. 4 will update all the future Minor and patch updates, for example, ^1.2. 4 will automatically change the dependency to 1. x.x if any update occurs.

What's the difference between a tilde (~) and a caret in a npm package json file?

npm uses the tilde (~) and caret (^) to designate which patch and minor versions to use respectively. If you see ^1.0. 2 it means to install version 1.0. 2 or the latest minor or patch version such as 1.1.

What is peerDependencies in package json?

Peer Dependencies: In package. json file, there is an object called as peerDependencies and it consists of all the packages that are exactly required in the project or to the person who is downloading and the version numbers should also be the same. That is the reason they were named as peerDependencies.


1 Answers

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

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

like image 89
Jondlm Avatar answered Sep 21 '22 19:09

Jondlm