[英]Set private npm registry on docker node.js application from WebStorm run/debug configuration
How to change npm registry for Node.JS interpreter using docker image in run/debug configuration
? 如何在
run/debug configuration
使用Docker映像更改Node.JS解释器的 npm注册表 ?
I realised that WebStorm automatically regenerate JetBrains.Dockerfile
, but when I tried to edit that file directly and hit play button again, WebStorm will regenerate new dockerfile instead of using the updated file. 我意识到WebStorm会自动重新生成
JetBrains.Dockerfile
,但是当我尝试直接编辑该文件并再次单击播放按钮时,WebStorm会重新生成新的dockerfile而不使用更新的文件。
Is there anyway to use private npm registry in this configuration? 无论如何,是否在此配置中使用私有npm注册表?
I found the work around to achieve this: 我找到了解决此问题的方法:
First I added new npm script in package.json: 首先,我在package.json中添加了新的npm脚本:
"set:registry": "npm config set registry=\"npm repository\"",
Then in the run/debug configuration, I added Before launch: npm script
to run set:registry
script task so it will set the registry to the private npm registry before run npm install. 然后在运行/调试配置中,我添加了
Before launch: npm script
以运行set:registry
脚本任务,因此它将在运行npm install之前将注册表设置为私有npm注册表。
NB: Still looking for the best way to accomplish this, since this workaround has some changes in the package.json file. 注意:由于此解决方法在package.json文件中进行了一些更改,因此仍在寻找实现此目的的最佳方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.