大家好日子!
在 package.json 上,scripts
下的一行显示为"serve": "node index -test"
。如果我在Node命令提示符中直接运行node index -test
,则不会发生错误。如果我运行npm run serve
,假设做同样的事情,那么当我用Ctrl + C停止进程时会发生错误。这是日志:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\SOUSA\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using npm@6.0.1
3 info using node@v10.1.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle alloy-server@3.0.0~preserve: alloy-server@3.0.0
6 info lifecycle alloy-server@3.0.0~serve: alloy-server@3.0.0
7 verbose lifecycle alloy-server@3.0.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle alloy-server@3.0.0~serve: PATH: C:\Users\SOUSA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Alloy_Server_v3\node_modules\.bin;C:\Users\SOUSA\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\ImageMagick-6.9.3-Q16;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\ImageMagick-6.9.1-Q16;C:\Program Files\ImageMagick-6.9.0-Q16;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\git\cmd;C:\Program Files (x86)\Windows Live\Shared;C:\ProgramData\chocolatey\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\nodejs\;C:\Users\SOUSA\.cargo\bin;C:\NVPACK\gradle-2.9\bin;C:\NVPACK\jdk1.8.0_77\bin;C:\Users\SOUSA\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\SOUSA\AppData\Local\Microsoft\WindowsApps;C:\Users\SOUSA\AppData\Roaming\npm
9 verbose lifecycle alloy-server@3.0.0~serve: CWD: C:\Alloy_Server_v3
10 silly lifecycle alloy-server@3.0.0~serve: Args: [ '/d /s /c', 'node index -test' ]
11 silly lifecycle alloy-server@3.0.0~serve: Returned: code: 3221225786 signal: null
12 info lifecycle alloy-server@3.0.0~serve: Failed to exec serve script
13 verbose stack Error: alloy-server@3.0.0 serve: `node index -test`
13 verbose stack Exit status 3221225786
13 verbose stack at EventEmitter.<anonymous> (C:\Users\SOUSA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\SOUSA\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:957:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:246:5)
14 verbose pkgid alloy-server@3.0.0
15 verbose cwd C:\Alloy_Server_v3
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\SOUSA\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve"
18 verbose node v10.1.0
19 verbose npm v6.0.1
20 error code ELIFECYCLE
21 error errno 3221225786
22 error alloy-server@3.0.0 serve: `node index -test`
22 error Exit status 3221225786
23 error Failed at the alloy-server@3.0.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225786, true ]
我试图无济于事的事情:
npm install
我一直在寻找有关此退出状态3221225786的更多信息,但三小时后我仍然无法解决问题。非常感谢任何帮助。
编辑:当我使用VS Code控制台时,也不会发生错误。它只发生在Node.js命令提示符下。
答案 0 :(得分:0)
如果有人遇到同样的错误,当我更新到Node 10.2.0和NPM 6.0.1时问题就消失了。所以我想更新或者新安装可以解决它。