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
Cmd
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
Cmd

线上发布

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

出现问题
callback must be a funciton received undefined

local-fs.js

42行

fs.unlink(tmp,function(){})
JavaScript



之后

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
posted @ 2021-07-14 19:58  小李的博世界  阅读(395)  评论(0编辑  收藏  举报