Yasaman.Mansouri
Yasaman.Mansouri

Reputation: 560

error in running an react js application in windows

I'm using node(12.16.2) and npm(6.14.4) and create-react-app(3.4.1). After creating an app with create-react-app {app name} and going to its directory, I run it with npm start I see error below. I think the problem is with my npm not spawn. Here is the error:

> [email protected] start C:\Users\Yasaman\Desktop\tesssssst
> react-scripts start

i 「wds」: Project is running at http://0.0.0.0:3000/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\Yasaman\Desktop\tesssssst\public
i 「wds」: 404s will fallback to /
Starting the development server...

events.js:287
      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! [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\Yasaman\AppData\Roaming\npm-cache\_logs\2020-04-26T20_33_07_370Z-debug.log

How can I fix this problem?

Upvotes: 1

Views: 1616

Answers (1)

AmerllicA
AmerllicA

Reputation: 32512

For ridiculous issues, seek to find ridiculous solutions. It happens just because of your environment settings. You should set your Windows environment variable and add %SystemRoot%\system32 to your PATH. In the following, you can see the steps of doing PATH:

  1. On the Windows desktop, right-click My Computer.

  2. In the pop-up menu, click Properties.

  3. In the System Properties window, click the Advanced tab, and then click Environment Variables.

  4. In the System Variables window, highlight Path and click Edit.

  5. In the Edit System Variables window, insert the cursor at the end of the Variable Value field.

  6. If the last character is not a semi-colon (;), add one.

  7. After the final semi-colon, type the full path to the file you want to find.

    %SystemRoot%\system32
    
  8. Click OK in each open window

  9. Restart System

Upvotes: 3

Related Questions