Vetterjack
Vetterjack

Reputation: 2505

NPM always install latest prerelease version

I'm currently setting up pre-releases (under the dev tag) for a new npm package of mine.

enter image description here

In my staging environment, I want npm to always install the latest pre-release version of the 2.0.0 version. Therefore, I specified "<packagename>": ">=2.0.0-dev.0" in the package.json, but npm somehow always installs the 2.0.0-dev.20180806T153307Z.3eaa718.HEAD, even if I do a clean install with removed package-lock.json. According to the semver-checker my constraint matches the pre-releases published to npm.

Upvotes: 3

Views: 2555

Answers (1)

Vetterjack
Vetterjack

Reputation: 2505

I finally found the problem. Because there was no previous non-dev release published to npm for this package, npm always installed the pre-release version connected to the latest tag (see the image above in the question). The solution is to simply publish a fake release under an older version, e.g. 1.9.9. Now, a clean npm install works like expected.

Upvotes: 2

Related Questions