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

As it is not mentioned in @Noel's answer, you can run this if you don't want to do yarn config ... and don't want to have false prefix:

echo save-prefix \"\" >> .yarnrc

It puts the following in .yarnrc:

save-prefix ""

which installs packages for the current project without any prefix.

Note: "" means empty string, i.e. put nothing as a prefix.


For anyone looking for a Yarn 2 solution, add .yarnrc.yml with the following content:

defaultSemverRangePrefix: ""

Reference: https://yarnpkg.com/configuration/yarnrc


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 ""