1.到npm官網(wǎng) https://www.npmjs.com注冊賬號扁耐,記得驗證郵箱攒巍。
2.在項目終端輸入
npm adduser
輸入用戶名吠卷,密碼朵逝,郵箱即可登入成功
如果是npm淘寶鏡像,那么是無法登陸成功的
輸入以下指令解決
npm i nrm -g
nrm use npm
3.驗證是否登錄成功
npm whoami
4.發(fā)布
npm publish
5.安裝
npm install 你的包名
注:1.升級包的時候直接更改版本號
2.刪除包的時候在登錄后可直接刪除
3.如出現(xiàn)426情況設(shè)置重新執(zhí)行
4.如出現(xiàn)403也有可能是包名重復
npm i nrm -g
nrm use npm
npm config set registry=https://registry.npmjs.org
//切回 npm config set registry https://registry.npm.taobao.org