How to not add caret ^ sign to package installed with yarn?

Issue

I saw a solution for npm to change version prefix https://docs.npmjs.com/misc/config#save-prefix. What’s the solution for yarn to not add caret?

I’d like to configure it not globally, but only for current project, if possible.

So, when I run something like yarn add --dev webpack, it saves its version as "webpack": "3.6.0", not "webpack": "^3.6.0".

Solution

You can do

$ yarn config set save-prefix false

or

$ echo save-prefix false >> .yarnrc

https://yarnpkg.com/lang/en/docs/cli/config/


Edit

setting the value to false will install packages like this "some-package": "false3.0.4", which can be a bit misleading. If you don’t want a prefix at all then set it to an empty string via yarn config set save-prefix ""

Answered By – Noel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published