Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json 的版本号以及 npm publish 发布测试包 #170

Open
lovelmh13 opened this issue Sep 24, 2021 · 0 comments
Open

package.json 的版本号以及 npm publish 发布测试包 #170

lovelmh13 opened this issue Sep 24, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

假如,我们有个 npm 包叫 test

  1. 当版本号是 0.0.1 这种的时候,我们执行 npm publish,然后我们 npm i test,装上的是 0.0.1 版本的 test 包。
  2. 当版本号是 0.0.1-1 这种的时候,我们执行 npm publish,然后我们 npm i test。分两种情况
    1)我们之前没有安装过 test 包,那么会安装上 0.0.1-1
    2)我们之前已经安装过 test 包了,那么还是会安装上 0.0.1,并不会安装上带有 -1 的版本的包
  3. 当版本号是 0.0.1-beta1,我们执行 npm publish --tag=beta1,然后我们 npm i test,不管之前我们有没有装过 test 包,都不会安装上 0.0.1-beta1,除非我们安装指定的版本 npm i test@0.0.1-beta1

所以当我们想用 npm publish 发布一个测试包的时候,我们可以采取 npm publish --tag=beta1 这种来发布,只在版本号后面带一个 -,并不保险,别人也可能直接安装上这个版本的包

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant