1、註冊賬號
打開https://www.npmjs.com/,註冊一個賬號。註冊好後到註冊的郵箱確認一下。
2、查看項目的package.json配置
可以在這裏配置name(包名)、version(版本號)、description(描述)、main(入口文件)、files(包含的文件夾)等。
3、確認npm的源是https://registry.npmjs.org
查看當前源
npm config get registry
修改源
npm config set registry https://registry.npmjs.org
4、在終端登錄賬號
npm adduser
按提示輸入用戶名和密碼等(注意密碼輸入是不顯示的,不是沒寫上)
5、發包
發包前確認自己的項目構建好了,然後在命令行運行
npm publish --access public
發佈成功後就可以在npm網站上找到了,然後就可以在項目裏安裝自己的包了(^o^)/~
END-------------------------------
I see skies of blue, clouds of white
The bright blessed day, the dark sacred night
And I think to myself, what a wonderful world
I see trees of green, red roses too
I see them bloom for me and you
And I think to myself, what a wonderful world