首先,分享一下,nexus的說明文檔。nexus官網的文檔說明這個連接中的help,打開,而後右側有個能夠打開的連接Repository Management With Nexus - free comprehensive book,打開後,你會發現這裏是不一樣版本的文檔說明,以下圖。node
而後能夠選擇你正在試用的Nexus Repository Manager的版本進行查看,咱們使用的是3.0版本的,而後在第10章是專門介紹npm私服的。npm
這裏面一共有3中類型的npm倉庫:ide
Proxying npm Registries 代理倉庫grunt
To reduce duplicate downloads and improve download speeds for your developers and CI servers, you should proxy the registry hosted at https://registry.npmjs.org. By default npm accesses this registry directly. You can also proxy any other registries you require.
大體的意思就是說,能夠訪問遠程倉庫的一些代碼,好比angular的代碼測試
Private npm Registries 託管倉庫ui
A private npm registry can be used to upload your own packages as well as third-party packages. You can create a private npm registry by setting up a hosted repository with the npm format in the repository manager. It is good practice to create two separate hosted repositories for these purposes.
大體的意思是說,這是你的私服,能夠放你要放到本身的npm私服上的代碼this
Grouping npm Registries 存儲庫組(不知道這樣翻譯怎麼樣)命令行
A repository group is the recommended way to expose all your npm registries repositories from the repository manager to your users, without needing any further client side configuration. A repository group allows you to expose the aggregated content of multiple proxy and hosted repositories with one URL to npm and other tools.
這是一個綜合性的庫組,能夠將請兩個綜合起來,下面有詳細的介紹。翻譯
建立Proxying npm Registries 代理倉庫。3d
建立Proxying npm Registries hosted本地倉庫。
建立 Grouping npm Registries 綜合倉庫
到這裏,已經完成了50%了。好了,咱們來看一下,建立好的npm私服。
接下來,咱們須要配置一下npm
到這裏,npm的私服建立完畢,接下來,咱們要驗證一下了。
隨便在一個目錄下,進入cmd,而後執行npm –loglevel info install grunt,看看是夠可以下載成功,只是下載成功是不夠,還要看下,是否是從你的npm私服中進行下載的。
下圖是下載成功,在對應目錄下會多一個文件node_modules,注意,你須要刪除,由於是測試的
還須要驗證是不是從npm私服中下載的。
ok。到這裏結束了,個人淚啊,但願能給你幫助!