1.在 https://www.npmjs.com/ 上注册账号

2.确保npm的源是本身的源 https://registry.npmjs.org

3.在项目的根目录的终端中登录你的账号

npm adduser或者npm login

4.将包发布为公共包,因为前段时间npm修改了发包模式分为私有包和公共包,如果不添加–access public命令会报错

npm publish --access public

5.更新包版本

npm version 版本号

npm publish

6.撤销发布的包

npm unpublish --force //强制删除
npm unpublish guitest@1.0.1 //指定版本号
npm unpublish的推荐替代命令:npm deprecate <pkg>[@<version>] <message>

使用这个命令,并不会在社区里撤销你已有的包,但会在任何人尝试安装这个包的时候得到警告
例如:npm deprecate penghuwanapp '这个包我已经不再维护了哟
注意:

  • 1根据规范,只有在发包的24小时内才允许撤销发布的包( unpublish is only allowed with versions published in the last 24 hours)
  • 2即使你撤销了发布的包,发包的时候也不能再和被撤销的包的名称和版本重复了(即不能名称相同,版本相同,因为这两者构成的唯一标识已经被“占用”了)

相关细节说明请查看

tips1:如果想关联github仓库

npm更新python版本 npm怎么更新_gulp

//关联GitHub,在package.json 中添加
{
  "repository": {
    "type": "git",
    "url": "https://github.com/itlixiaolong/qiankun-cli.git"
  }
}
tips2:开发时使用npm link链接到本地

npm链接痛:

  • 模块名称gulp-task
  • 项目名称project-x
您想链接gulp-task:

1:转到gulp-task目录,然后执行npm link此操作,将项目链接到全局模块

2:转到您的项目project-x,然后npm install确保删除当前的node_modules目录

现在,您要消除这种疯狂并使用真正的gulp-task,我们有两个选择:

选项1:通过npm取消链接:
1:转到您的项目,然后执行npm unlink gulp-task此操作将删除链接的已安装模块

2:转到gulp-task目录并执行npm unlink以删除符号链接。注意,我们没有使用模块的名称

3:庆祝

如果这不起作用怎么办,请找到全局安装的模块进行验证。我的位置,ls -la /usr/local/lib/node_modules/如果您使用的是nvm,它将是一个不同的路径

选项2:像普通的Linux大师一样删除符号链接
1:找到全局依赖项 cd /usr/local/lib/node_modules/

2:只需使用以下rm命令即可删除符号链接

rm gulp-task 确保你没有/最后

rm gulp-task/ 是错的 🔥🚨

rm gulp-task ✔️