我的package.json包含以下条目:
"scripts": {
"start": "forever start -p . -l ./server.log -a ./server.js",
如果我运行
forever start -p . -l ./server.log -a ./server.js
从命令行(PowerShell或cmd.exe),它可以按预期工作。但是,如果我输入:
npm run start
它像这样失败:
info: Forever processing file: ./server.js
fs.js:115
throw err;
^
Error: ENOENT: no such file or directory, open 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Jenkins\CustomWorkspace\SeleniumTests\AMI\server\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Oracle\product\11.2.0\dbhome_1\bin;C:\Program Files\Java\jdk1.8.0_172\bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Gecko\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GitExtensions\;C:\Program Files\PuTTY\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Binn;.\;%APPDATA%\Python\Scripts;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\Documents\WindowsPowerShell\server.log'
at Object.openSync (fs.js:436:3)
at Object.forever.startDaemon (C:\Jenkins\CustomWorkspace\SeleniumTests\AMI\server\node_modules\forever\lib\forever.js:460:14)
at C:\Jenkins\CustomWorkspace\SeleniumTests\AMI\server\node_modules\forever\lib\forever\cli.js:319:15
at C:\Jenkins\CustomWorkspace\SeleniumTests\AMI\server\node_modules\forever\lib\forever\cli.js:162:5
at C:\Jenkins\CustomWorkspace\SeleniumTests\AMI\server\node_modules\forever\lib\forever.js:409:24
at FSReqWrap.oncomplete (fs.js:155:5)
“ server.log”之前的路径是PATH环境变量的整个值。
我正在Windows 2012 Server标准上使用节点10.11.0和npm 6.1.0。