Skip to content

'react-scripts start' does not work on linux (WSL) #9644

@asim-sha

Description

@asim-sha

Describe the bug

On linux (WSL) npm run start fails with the following error
spawn powershell.exe ENOENT

Not sure why its trying to spawn powershell on Linux but this seem to have been introduced from version 3.0.0 of react-scripts. The workaround is to downgrade react-scripts to 2.1.8

This is reproducible on a fresh install using latest npm version 6.14.8 and latest nodejs verison 14.10.1 (also reproducible on 10.x)

Did you try recovering your dependencies?

Reproducible on a fresh install so unlikely its related to corrupt dependencies.

Environment

System:
    OS: Linux 4.19 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 14.10.1 - /usr/bin/node
    Yarn: Not Found
    npm: 6.14.8 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    react: ^16.13.1 => 16.13.1 
    react-dom: ^16.13.1 => 16.13.1 
    react-scripts: 2.1.8 => 2.1.8 
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app hello-world
  2. cd hello-world
  3. npm run start

Note: This is reproducible at least on Linux (WSL - Ubuntu), it maybe reproducible on Linux generally but I have not tested.

Expected behavior

Compiled successfully!

You can now view hello-world in the browser.

  Local:            http://localhost:3000/
  On Your Network:  http://172.31.234.113:3000/

Note that the development build is not optimized.
To create a production build, use npm run build.

Actual behavior

Starting the development server...

events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: spawn powershell.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:464:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
    at onErrorNT (internal/child_process.js:464:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn powershell.exe',
  path: 'powershell.exe',
  spawnargs: [
    '-NoProfile',
    '-NonInteractive',
    '–ExecutionPolicy',
    'Bypass',
    '-EncodedCommand',
    'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'
  ]
}

Reproducible demo

This can be reproduced on a newly created project so demo project is not relevant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions