简体   繁体   中英

Cannot publish alpha version to npm

I'm trying to publish an alpha version of my package to npm . I'm executing this commands: npm version 1.0.0-alpha.1 npm publish --tag 1.0.0-alpha.1 but instead of publishing, I'm getting an error: npm ERR! Tag name must not be a valid SemVer range: 1.0.0-alpha.1 npm ERR! Tag name must not be a valid SemVer range: 1.0.0-alpha.1

Had the same problem as you. According to the documentation ( http://doc.codingdict.com/npm-ref/all.html ):

Caveats

Because dist-tags share the same namespace as semver, avoid using tag names that may cause a conflict. The best practice is to avoid using tags beginning with a number or the letter "v".

So you don't have to specify the tag when you publish. You can just do this:-

npm version prerelease --preid=alpha.1
npm publish

If you want to specify the tag, you should do this:-

npm version prerelease --preid=alpha.1
npm publish --tag=alpha.1

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM