Say I have a package.json
file in an existing project. In there I have "some-package": "^1.0-01",
, however I know that the latest version is 1.0-02
So I do yarn upgrade
. However, package.json
is not update, and still references the -01
version. The yarn.lock
file however shows this:
some-package@^1.0-01:
version "1.0-02"
Is this expected behavior? When someone else does the yarn
command, which version will they get. If they get the latest version, isn't it misleading to show -01
in package.json
?
just run yarn upgrade-interactive --latest and select packages you want to update using space button and press the enter to update.
Running yarn upgrade without any modifiers does not update package. json . If we run yarn upgrade without any flags, it will install the latest version that matches the version pattern indicated by package. json .
With npm or yarn, you can install a package under a custom alias. This enables you to install multiple versions of a package in the same project.
yarn install is used to install all dependencies for a project. The dependencies are retrieved from your project's package. json file, and stored in the yarn. lock file.
According to the documentation here,
yarn upgrade
This command updates all dependencies to their latest version based on the version range specified in the package.json file. The yarn.lock file will be recreated as well.
The tricky part is based on the version range specified in the package.json
This means that if your package.json
has defined a particular semver like you've said, upgrade
will only upgrade it according to the range defined there, i.e. ^1.0-01
should upgrade to 1.0-02
in both your package.json
and yarn.lock
files.
Now you've said that this is happening only in your yarn.lock
file. Yarn provides a utility for checking for such clashes called check
Could you try running
yarn check
in your repository and tell us your findings?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With