简体   繁体   English

如何在离线构建服务器上安装Npm模块?

[英]How to install Npm module on offline build server?

We have an single page application developed in angular js using nodejs\\npm\\grunt . 我们有一个使用nodejs \\ npm \\ grunt在angular js中开发的单页应用程序。 I am tyring to integrate this into an asp.net 4.5 mvc project. 我想将其集成到一个asp.net 4.5 mvc项目中。 For the most part of it, I was able to preserve the DEV environment by using the new task runner functionality in VS. 在大多数情况下,我能够通过使用VS中的新任务运行器功能来保留DEV环境。 I changed the build events to run npm\\bower install and do a grunt build before the .net code builds. 我将构建事件更改为运行npm \\ bower install,并在构建.net代码之前进行了仔细的构建。 But I realized that our build server isn't connected to Internet and thus can't restore node and bower packages I am not able to checkin the node packages into TFS as some of the have very long paths that are incompatible with most of windows tools. 但是我意识到我们的构建服务器未连接到Internet,因此无法还原节点和Bower软件包,我无法将节点软件包检入到TFS中,因为其中一些路径很长,与大多数Windows工具都不兼容。 Is there any way to get around this issue ie can we install node & bower packages from offline source on the build servers? 有什么方法可以解决此问题,即我们可以从构建服务器上的脱机源安装节点和Bower软件包吗? Thanks. 谢谢。

Assuming your build server is on a local network, you could set up a local npm registry and mirror the required packages there. 假设构建服务器在本地网络上,则可以设置本地npm注册表并在其中镜像所需的软件包。 You'd then just need to set the registry url by using the --registry command line flag or by setting npm_config_registry as an environment variable. 然后,您只需要使用--registry命令行标志或通过将npm_config_registry设置为环境变量来设置注册表URL。 There are instructions on how to set up a node registry on clock.co.uk . 在clock.co.uk上有关于如何设置节点注册表的说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM