- 访问 https://www.npmjs.com/ ,注册登录账号
- 控制台输入
npm config get registry
查看是否为 npmjs 的源地址https://registry.npmjs.org/
- 如果不是,需要将其修改
npm config set registry https://registry.npmjs.org
用第一步注册的账号密码登录
npm adduser
执行
npm publish
- 检查要发布的包的 package.json 中的 main 主文件的地址是否是你 webpack 打包出来的文件的地址,同时注意版本号