次の手順でWindowsにReactをインストールしました。
npm install -g create-react-app
create-react-app test3
次いで
cd test3
npm start
とすると、以下のエラーメッセージが出てしまいます。
Starting the development server... events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn cmd 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 cmd', path: 'cmd', spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! test3@0.1.0 start: `react-scripts start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the test3@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. Starting the development server... events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn cmd 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 cmd', path: 'cmd', spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! test3@0.1.0 start: `react-scripts start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the test3@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
やってみたこと
- 環境変数にC:\Windows\System32を追加
- Node.jsをアンインストールし(\AppData\Roming\npm, \AppData\Roming\npm_chche共に)、最新版Node.js(v12.18.2)再インストール。
test3フォルダ一旦削除後、
npm install -g create-react-app
create-react-app test3
を再度実行。
結果は変わらず、同じエラーが出てしまいます。ちなみに、Macに同じ手順でインストールしたReactは正常に起動しています。何が原因でしょうか?