We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
最近面试的时候有被问过:你对npm了解多少?有发布过包吗? 当时我表示一脸懵逼、其实是有参与过npm包的代码维护,但未曾自己发布过包。。趁着热乎劲儿,在网上找下资料,简单的记录下吧
主要从注册账号、到编写包代码、到发布、到删除的一系列操作吧
sudo npm install verdaccio -g
verdaccio
http://localhost:4873
npm set registry http://localhost:4873
npm adduser –registry http://localhost:4873
// 创建测试文件夹 mkdir npmtest // 初始化项目,一路回车即可 npm init // 创建index.js文件,内容如下 !function(){ console.log(`这是引入的包入口`) }()
// 发布 npm publish // 期间可能会遇到提示未登录的错误信息,重新登录下即可,输入userName 和 password 和 email npm login –registry http://localhost:4873
// 创建测试目录 mkdir test // 初始化项目,一路回车 npm init // 安装我们自己的包依赖,可以在package.json文件中看到 npm install npmtest@1.0.0 --save-dev // 编写测试文件index.js,内容如下 var f = require('npmtest') // 执行测试文件,结果如下图所示就OK了 node index.js
如何搭建一个私有 npm 服务器
一分钟教你发布npm包
The text was updated successfully, but these errors were encountered:
No branches or pull requests
起因
简介
流程
verdaccio
命令即可运行http://localhost:4873
,如果未发布过包,则会见到如下所示的图参考
如何搭建一个私有 npm 服务器
一分钟教你发布npm包
The text was updated successfully, but these errors were encountered: