1. 程式人生 > >NodeJS學習(三) npm打包

NodeJS學習(三) npm打包

  1. 在npm官網註冊賬戶,記住username,password,email
  2. 新建一個專案,生成package.json檔案
npm init
  1. 關聯npm使用者資訊,提示輸入剛剛註冊的三個資訊
npm adduser
  1. 釋出包
npm publish

    • 如果上傳成功會提示
D:\code\publishbaiyu>npm publish
+ [email protected]

問題

npm ERR publish 403

You do not have permission to publish 'somepackage'
.Are you logged in as the corrent user?:somepackage

意思是我沒許可權釋出somepackage,並問我是否使用了正確的賬號,
那也許是somepackage被別人釋出過了吧,所以我修改了package.json檔案。把name改成somepackage_xiaotian.

npm ERR! publish Failed PUT 403
npm ERR! code E403
npm ERR! you must verify your email before publishing a new package: https://www.npmjs.com/email-edit : publishbaiyu

npm
ERR! A complete log of this run can be found in: npm ERR! C:\Users\by\AppData\Roaming\npm-cache\_logs\2017-09-06T03_14_24_349Z-debug.log

意思是剛剛在npm註冊的賬號還沒有經過驗證,需要登入註冊時的郵箱,點選連結,並登入後,才算驗證完畢,驗證後,提示成功,如下:

D:\code\publishbaiyu>npm publish
+ [email protected]