npm 安装

本地开发

第一步,安装
sinopia
npm install -g sinopia
开启终端一:
第二步,启动
sinopia -l 127.0.0.1:4873
开启终端二:
cd 到某个指定仓库
mkdir unit-restful-axios(包的名称)
cd unit-restful-axios
npm init
生成package.json
PS:main 为index.js
在index.js 中复制 unit/index.js的内容
接下来 以下操作
第三步,创建新用户
npm adduser --registry http://127.0.0.1:4873
第四步,发布npm包
npm publish --registry http://127.0.0.1:4873
第五步,设置npm请求源(也可以提前设置)
npm config set registry http://127.0.0.1:4873
```js
```js
npm adduser --registry http://127.0.0.1:4873
npm publish --registry http://127.0.0.1:4873
sinopia -l 127.0.0.1:4873
npm config set registry http://127.0.0.1:4873
```js
### 线上发布

npm 官方发布
npm config set registry https://registry.npmjs.org/
npm publish
npm login

 - 出现问题 callback must be a funciton received undefined  local-fs.js  42行
```js
fs.unlink(tmp,function(){})

  • 之后
npm adduser --registry http://127.0.0.1:4873
npm publish --registry http://127.0.0.1:4873
sinopia -l 127.0.0.1:4873
npm config set registry http://127.0.0.1:4873
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容