一、須要修改地址,通常爲了下載速度快會改成npm config set registry https://registry.npm.taobao.org,但發佈npm包時必須爲npm的地址:npm config set registry http://registry.npmjs.org/
npm ERR! code E403
npm ERR! 403 Forbidden - PUT https://registry.npm.taobao.org/vue-short-cut - [no_perms] Private mode enable, only admin can publish this module複製代碼
二、包重名,修改package.json中的name
npm ERR! publish Failed PUT 403
npm ERR! code E403
npm ERR! You do not have permission to publish "vue-short-cut". Are you logged inas the correct user?
複製代碼
npm ERR! code E403
npm ERR! 403 Forbidden - PUT http://registry.npmjs.org/vue-short-cut - Package name too similar to existing packages; try renaming your package to '@logmei/vue-short-cut' and publishing with 'npm publish --access=public' instead複製代碼
四、版本不容許重複,須要修改package.json中的version
npm ERR! code E403
npm ERR! 403 Forbidden - PUT http://registry.npmjs.org/@logmei%2fvue-short-cut - You cannot publish over the previously published versions: 0.1.2.複製代碼
根據規範,只有在發包的24小時內才容許撤銷發佈的包( unpublish is only allowed with versions published in the last 24 hours); 即便你撤銷了發佈的包,發包的時候也不能再和被撤銷的包的名稱和版本重複了(即不能名稱相同,版本相同,由於這二者構成的惟一標識已經被「佔用」了)