react 建立好新專案,但執行npm start時出現錯誤
錯誤訊息為:
Windows PowerShell
Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn powershell',
path: 'powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello@0.1.0 start script.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jbuduoo\AppData\Roaming\npm-cache\_logs\2020-08-31T04_01_08_818Z-debug.log
PS D:\abc\hello\hello> sodu npm satart
sodu : 無法辨識 'sodu' 詞彙是否為 Cmdlet、函數、指令檔或可執行程式的名稱。請檢查名稱拼字是否正確,如果包含路徑
的話,請確認路徑是否正確,然後再試一次。
位於 線路:1 字元:1
+ sodu npm satart
+ ~~~~
+ CategoryInfo : ObjectNotFound: (sodu:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS D:\abc\hello\hello> npm run
Lifecycle scripts included in hello:
start
react-scripts start
test
react-scripts test
available via `npm run-script`:
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn powershell',
path: 'powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn powershell',
path: 'powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jbuduoo\AppData\Roaming\npm-cache\_logs\2020-08-31T04_03_18_678Z-debug.log
log的訊息是
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle hello@0.1.0~prestart: hello@0.1.0
6 info lifecycle hello@0.1.0~start: hello@0.1.0
7 verbose lifecycle hello@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle hello@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\abc\hello\hello\node_modules\.bin;D:\Java\jdk-11.0.2;C:\Syscom\java\spring-2.2.6.RELEASE\bin;D:\Software\Maven\apache-maven-3.6.3\bin;C:\Users\jbuduoo\Python\Python36;D:\Java\jdk-11.0.2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\nodejs\;C:\Syscom\java\spring-2.3.3.BUILD-SNAPSHOT\bin;C:\Microsoft VS Code\bin;D:\GoogleCloud\google-cloud-sdk\bin;C:\Users\jbuduoo\AppData\Local\GitHubDesktop\bin;C:\Users\jbuduoo\AppData\Roaming\npm
9 verbose lifecycle hello@0.1.0~start: CWD: D:\abc\hello\hello
10 silly lifecycle hello@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle hello@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle hello@0.1.0~start: Failed to exec start script
13 verbose stack Error: hello@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid hello@0.1.0
15 verbose cwd D:\abc\hello\hello
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error hello@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the hello@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
環境重新設置了,但找了好久找不出解決方式,我用管理者模式登錄進去也不行,可否請大神支援一下。