The change
This was a breaking change with npm v9. The release notes are available here.
Including this detail on the option;
install-links config defaults to "true"
In particular, there is this note in the release of node v18.4 here, motivating the change;
Explanation: install-links is the only config or command in the list that has an effect on package installs. We fixed a number of issues that came up during prereleases with this change. It will also only be applied to new package trees created without a package-lock.json file. Any install with an existing lock file will not be changed.
In our use case, this broke the build and a change to the intended use of the functionality to begin with.
If set to false, then the "current/old/pre v9" behaviour is restored.
Restoring the behaviour
Depending on the use case, there seem to be two options to consider;
- Add the option
--install-links=false to the command line. Good for single use cases.
- Add the line
install-links=false to the .npmrc file in the project root. Seems to be the better option for CI/CD environments.
Note: the package-lock file format may have to be version 3 (or above) for the above to work.