# 發布npm包
## 注冊并在本機添加npm用戶(已注冊可忽略)
完成了上面的步驟之后,我們接下來要在[www.npmjs.com]()注冊一個賬號,這個賬號會被添加到npm本地的配置中,下面命令行將會使用到。
```
//前提已完成npm用戶的注冊
$ npm adduser
Username: your name
Password: your password
Email: yourmail@gmail.com
```
如果出現以下錯誤,可能是你的npm版本太低,通過`sudo npm install -g npm`升級一下。
```
npm WARN adduser Incorrect username or password
npm WARN adduser You can reset your account by visiting:
npm WARN adduser
npm WARN adduser http://admin.npmjs.org/reset
npm WARN adduser
npm ERR! Error: forbidden may not mix password_sha and pbkdf2
npm ERR! You may need to upgrade your version of npm:
npm ERR! npm install npm -g
npm ERR! Note that this may need to be run as root/admin (sudo, etc.)
```
成功之后,npm會把認證信息存儲在~/.npmrc中,并且可以通過以下命令查看npm當前使用的用戶:
```
$ npm whoami
```
以上完成之后,我們終于可以發布自己包了。
## 發布
```
$ npm publish
```
## 刪除
```
npm unpublish --force //強制刪除
```
```
npm unpublish guitest@1.0.1 //指定版本號
```
```
npm deprecate //某些情況
```
- [分享]微信小程序入門與實戰
- 學習大綱
- 關于學習的一些常見問題
- 第一周
- 每周作業
- 玩練作業
- 知識點
- 正確設置PORT端口(windows/mac)
- 發布npm包
- 第二周
- 每周作業
- [作業一 (通關作業)](第二周/作業一 (通關作業).md)
- 作業二 (通關作業)
- 作業三 (通關作業)
- 作業四(可選)
- 作業五(可選)
- 知識點
- 原型鏈及繼承的理解
- 第三周
- 每周作業
- 作業一 (通關作業)
- 作業二 (通關作業)
- 作業三 (通關作業)
- 作業四(可選)
- 知識點
- 正則表達式常用方法
- promise用法
- 常用正則表達式大全
- 第四周
- 每周作業
- 玩練作業
- 知識點
- 第五周
- 每周作業
- 作業一(通關作業)
- 作業二 (通關作業)
- 作業三(玩練作業)
- 知識點
- 第六周
- 每周作業
- [作業一(通關作業)](第六周/作業一(通關作業).md)
- 知識點
- 第七周
- 每周作業
- 作業一(玩練)
- 作業二(玩練)
- 作業三(通關)
- 作業四(通關)
- 知識點
- 第八周
- 每周作業
- 作業一(玩練)
- 作業二(玩練)
- 作業三(通關)
- 知識點
- 第九周
- 每周作業
- 作業一(玩練)
- 作業二(玩練)
- 作業三(玩練)
- 作業四(通關)
- 知識點
- 第十周
- 每周作業
- 作業一(玩練)
- 知識點