![]() ![]() If it is incompatible, then the latest compatible version will be installed. If it is compatible, no changes will be made. The installed version listed as a dependency in the lockfile must be compatible with the version specified in the package file. What confuses a lot of people about pnpm install/ npm install is how the lock-file works with the semver specifier: If I delete the node_modules/ folder and pnpm install again then we still have 4.17.3. ![]() The dependencies section in the lock file should reflect the version that is installed, or will be installed. The specifiers section in the lock file is just what we specify as the dependency in the package.json file. If you think about what the ~ means then this is expected. This time it did update the dependency and installed the latest patch version but did install the exact major and minor version. ![]() Ok, now try updating the minor version in package.json to ~4.17.0. ![]() If I delete the node_modules/ directory and reinstall, still no change. Note that the install version did not change. Now if I change package.json to be exactly v 4.16.0 we shall see an update to pnpm-lock.yaml specifiers:Īdding the patch wildcard ~4.16.0 and running pnpm install again gives: specifiers: Lockfile is up to date, resolution step is skipped Giving it a first run without changing anything produces: $ pnpm install The package.json will contain (at time of writing): "express": `"^4.18.2"`Ī pnpm-lock.yaml is also created: specifiers: Similarly, to allow any minor version use ^. If you don't mind which patch release you have as long as it is the specified major and minor version you can use the ~ prefix. The semver specification explains how to use semantic versioning though you can probably skip to the npm docs.Īs you probably know the numbers are in the form. See also why-does-npm-install-rewrite-package-lock-json Semver ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |