当前位置: 移动技术网 > IT编程>开发语言>JavaScript > npm私服搭建

npm私服搭建

2018年12月29日  | 移动技术网IT编程  | 我要评论

本文是在 centos7 下利用 nexus 搭建 npm 私服的整理

一、

二、安装 nexus

1、下载

2、解压

tar -zxvf nexus-3.14.0-04-unix.tar.gz -c /usr/local/

3、修改配置文件(可选)

vi /usr/local/nexus-3.14.0-04/etc/nexus-default.properties

4、增加用户(可选)

useradd nexus

如果使用的 root 用户运行会有警告信息

5、设置启动用户(可选)

vi /usr/local/nexus-3.14.0-04/bin/nexus.rc

添加一行

run_as_user="nexus"

6、修改 ulimit(可选)

vi /etc/security/limits.conf

添加

nexus - nofile 65536

重启,查看

ulimit -n

如果不修改

7、启动/停止

/usr/local/nexus-3.14.0-04/bin/nexus start/stop

三、npm私服搭建

浏览器输入 http://www.lhsxpumps.com/_localhost:8081 进入管理界面,默认账号密码 admin/ admin123

1、添加 npm

有三个选项可供选择,这里使用一种常用的方式,三种 npm 都分别创建

2、npm (proxy) 仓库

3、npm (hosted) 仓库

4、npm (group) 仓库

 

 

5、使用

在 .npmrc 文件中添加 registry = http://www.lhsxpumps.com/_localhost:8081/repository/npm-g/ 

npm -loglevel info install axois

6、设置权限

npm login –registry=http://localhost:8081/repository/npm-g

7、发布

npm adduser –registry http://localhost:8081/repository/npm-g
npm publish –registry http://localhost:8081/repository/npm-g

参考资料:

https://www.cnblogs.com/grey-wolf/p/6481166.html

https://blog.csdn.net/itkingone/article/details/81448592

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网