每当我尝试运行任何nodejs项目时,都会显示一条错误消息error syscall spawn C:\Windows\system32\cmd.exe
。所有的nodejs项目都遇到相同的错误。安装python并使用pythonpath修改系统环境变量后出现了问题。我得到的错误是:
verbose stack Error: firsttypescript@1.0.0 start: `tsc-watch --onSuccess "node ./dist/index.js" --onFailure echo`
verbose stack spawn C:\Windows\system32\cmd.exe; ENOENT
verbose stack at _errnoException (util.js:992:11)
verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
verbose stack at onErrorNT (internal/child_process.js:372:16)
verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
verbose pkgid firsttypescript@1.0.0
verbose cwd D:\trainingTasks\firstTypeScript
verbose Windows_NT 6.3.9600
verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
verbose node v8.11.3
verbose npm v5.6.0
error file C:\Windows\system32\cmd.exe;
error path C:\Windows\system32\cmd.exe;
error code ELIFECYCLE
error errno ENOENT
error syscall spawn C:\Windows\system32\cmd.exe;
error firsttypescript@1.0.0 start: `tsc-watch --onSuccess "node ./dist/index.js" --onFailure echo`
error spawn C:\Windows\system32\cmd.exe; ENOENT
error Failed at the firsttypescript@1.0.0 start script.
我的系统环境变量路径为:
C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32\cmd.exe;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\PuTTY\;C:\Users\abhishek.m\AppData\Local\Programs\Python\Python37\Scripts;%PYTHONPATH%
答案 0 :(得分:0)
验证是否具有ComSpec变量C:\ Windows \ System32 \ cmd.exe。
并尝试在没有\ cmd.exe的情况下替换路径值: C:\ ProgramData \ Oracle \ Java \ javapath;C:\ Windows \ System32;%SystemRoot%\ sy ...等等...