【发布时间】:2018-07-10 02:26:46
【问题描述】:
我有 npm 同时加载的任务、节点检查器和节点主管。
{
"start": "concurrently --kill-others \"node-inspector\" \"set NODE_PATH=.&&supervisor -n error -- ./bin/www --debug\"",
"prestart": "start chrome http://localhost:3000 http://localhost:8080/debug?port=5858"
}
结果:
[1] set NODE_PATH=.&&supervisor -n error -- ./bin/www --debug exited with code 0
--> Sending SIGTERM to other processes..
[0] Node Inspector v0.12.7
[0] Visit http://127.0.0.1:8080/?port=5858 to start debugging.
但是当我尝试localhost:3000 时,我得到了ERR_CONNECTION_REFUSED。
问题 1:如何将 NODE_PATH=.(或任何其他 ENV 变量)传递给主管 - 以便我的节点正常运行?
问题 2: 或者您知道如何在 npm 脚本中组织两个监视任务?例如:node-supervisor 和 node-inspector
注意1:如果我直接从命令行运行set NODE_PATH=.&&supervisor -n error -- ./bin/www --debug - 效果很好。
注意2:如果我在没有NODE_PATH=.&& 的情况下运行npm start,它运行良好但节点错误 - 导致它找不到模块,例如require('helpers/log') 或require('models/user') 因为我没有想把所有东西都放在node_modules。
统计数据:
- Windows 8.1
- 节点 4.4.0
- npm 2.4.0
【问题讨论】: