user14152355
user14152355

Reputation:

Error when trying to run npm start command

I am trying to create a react project i have run npx create-react-app hello-react --use-npm then cd hello-react but when I've npm start this error has been shown:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\develompent\Desktop\react\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\develompent\Desktop\react\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\develompent\AppData\Roaming\npm-cache\_logs\2020-08-30T18_43_59_773Z-debug.log

C:\Users\develompent\Desktop\react>cd hello-react

C:\Users\develompent\Desktop\react\hello-react>npm start

> [email protected] start C:\Users\develompent\Desktop\react\hello-react
> react-scripts start

i 「wds」: Project is running at http://192.168.137.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\develompent\Desktop\react\hello-react\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! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\develompent\AppData\Roaming\npm-cache\_logs\2020-08-30T18_44_47_550Z-debug.log

i have tried to to delete the node_modules then I've installed it another time but the same issue still happening and I also tried to run the cmd as an administrator but it did not open without showing any errors

Upvotes: -1

Views: 1661

Answers (3)

user14152355
user14152355

Reputation:

downgrade react scripts for project with these commands

npm install [email protected]
npm start

Upvotes: 4

user13769010
user13769010

Reputation:

You can try to reinstall node in the path C:\windows\System32

or you can

Follow these steps:

  • npm cache clean --force
  • delete node_modules folder
  • delete package-lock.json file
  • npm install

Upvotes: 0

Juan Bojato
Juan Bojato

Reputation: 26

Create a new folder and try with this:

npx create-react-app my-app
cd my-app
npm start

You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine

https://reactjs.org/docs/create-a-new-react-app.html

Upvotes: 0

Related Questions