发布第一个npm包的过程记录
开始注册,出现下面错误
C:\Users\Administrator>npm adduser npm notice Log in on https://registry.npm.taobao.org/ Username: npm_nbacheng Password: Email: (this IS public) 498871963@qq.com npm ERR! code E403 npm ERR! 403 403 Forbidden - PUT https://registry.npmmirror.com/-/user/org.couchdb.user:npm_nbacheng - [FORBIDDEN] Public registration is not allowed npm ERR! 403 In most cases, you or one of your dependencies are requesting npm ERR! 403 a package version that is forbidden by your security policy, or npm ERR! 403 on a server you do not have access to. npm ERR! A complete log of this run can be found in: npm ERR! D:\Program Files\nodejs\node_cache\_logs\2022-09-15T16_04_28_424Z-debug-0.log
一直注册几次都是这样,原来用阿里的不行,修改成如下
npm config set registry https://registry.npmjs.org
这样算是注册成功了
这样应该是国外网速问题,搞了几次后才成功
cd F:\test\workflow-bpmn-modeler-nbacheng
npm init
按照提示输入相关信息
把制作好的工程拷贝进来
npm login
登录后
npm publish DONE Build complete. The docs\demo directory is ready to be deployed. INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html Done in 13.09s. + workflow-bpmn-modeler-nbacheng@0.1.0
出现上面情况就算成功了
平时正常操作还是换回淘宝吧
npm config set registry https://registry.npm.taobao.org
附发包指令:
注册:npm adduser
初始化:npm init
登录:npm login (初次发包)
发包:npm publish
撤销包:npm unpublish 包名
删除包:npm deprecate 包名 [@版本] “描述”
查看当前账号:npm whoami
本地联调:npm link
取消本地联调:npm unlink
查看安装了多少包:npm ls
查看node安装路径:npm get prefix
查看全局node包:npm root -g
清理缓存:npm cache clean -f
版本修改:
npm version patch:1.0.0会变成1.0.1
npm version major:1.0.0会变成2.0.0
npm version minor:1.0.0会变成1.1.0