简体   繁体   中英

npm start showing error after create-react-app

i have been trying to create a new react app but not able to npm start it. I am not able to understand the error msg. hope someone know it. also i tried github deploy yesterday(if it helps). the error i get after npm start is:-

D:\myportfolio>npm start

> myportfolio@0.1.0 start D:\myportfolio
> react-scripts start

i 「wds」: Project is running at http://192.168.43.213/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from D:\myportfolio\public
i 「wds」: 404s will fallback to /
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! myportfolio@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myportfolio@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\user\AppData\Roaming\npm-cache\_logs\2020-09-19T06_53_55_730Z-debug.log

I had this exact problem recently and this fix for Windows worked for me:

  1. Go to Control Panel
  2. Go to System and Security -> System -> Advanced System Settings
  3. Check out tab called Advanced then go to Environment Variables
  4. Click on Path, edit it by adding "C:\\Windows\\System32" at the end of the path, separated by semicolon. For example (AppData\\Roaming\\npm;C:\\Windows\\System32).

Lastly restart your computer for good measure. This is the only fix that worked for me after countless attempts to reinstall node modules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM