[英]How to split `npm install` to two steps to perform offline builds?
I am trying to build an application requiring NPM on Open Build Service .我正在尝试在Open Build Service上构建一个需要 NPM 的应用程序。 When building the application locally, one of the steps is
cd
ing into a directory containing package.lock
and then running npm install
.在本地构建应用程序时,其中一个步骤是
cd
进入包含package.lock
的目录,然后运行npm install
。
For obvious reasons this fails on a computer with no internet access.由于显而易见的原因,这在无法访问 Internet 的计算机上失败。
What I would like is to download the required node modules somehow and then add them as part of the application source.我想要以某种方式下载所需的节点模块,然后将它们添加为应用程序源的一部分。
If node_modules
included only text files, I could just tar it up and unpack it on the remote server.如果
node_modules
仅包含文本文件,我可以将其打包并在远程服务器上解压缩。 Unfortunately, some of the modules include binaries which are built by NPM using g++
, and I don't want to include opaque binaries as a “source”.不幸的是,其中一些模块包括由 NPM 使用
g++
构建的二进制文件,我不想将不透明的二进制文件作为“源”。
How can I split npm install
into two steps:如何将
npm install
拆分为两个步骤:
The first step is npm install --ignore-scripts
, the second is npm rebuild
.第一步是
npm install --ignore-scripts
,第二步是npm rebuild
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.