![](/img/trans.png)
[英]'lightercollective' is not recognized as an internal or external command, operable program or batch file
[英]Error running forever.js on Windows - "'C:\Program' is not recognized as an internal or external command, operable program or batch file"
我試圖通過 Windows 命令提示符運行forever.js
,我得到以下輸出:
>npm i -g forever
/my-project>forever start index.js
日志輸出:
'C:\\Program' is not recognized as an internal or external command, operable program or batch file
我認為這與forever
用於node
二進制文件的PATH
有關,但我不知道如何修復它...
編輯:永遠使用以下命令(用引號" "
括起來):
"C:\\Program Files\\nodejs\\node.exe"
安裝永久版本 1.0.0 為我解決了這個問題
我對永遠 2.0.0 有同樣的問題。
我在“forever.js”中使用了一種解決方法:(我通過“node ever.js”啟動我的應用程序)
const configChild = {
//
// Basic configuration options
//
silent: true, // Silences the output from stdout and stderr in the parent process
'killTree': true, // Kills the entire child process tree on `exit`
....
}
// =======================================================
// **Workaround for Windows**
// =======================================================
if (process.platform === 'win32' && process.execPath == "C:\\Program Files\\nodejs\\node.exe") {
configChild.command = '"C:\\PROGRA~1\\nodejs\\node.exe"';
}
const child = new (forever.Monitor)('app.js', configChild);
....
child.start();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.