Yarn Start Command failed with exit code 1
Asked Answered
H

7

10

I create react app with create-react-app and install react-admin . when I want to start development server with yarn start throw an error unhand-led 'error' event and say Command failed with exit code 1 I search a lot but nothing helped. See the error in the below image enter image description here

Hi answered 5/5, 2020 at 11:11 Comment(3)
Did you tried npm?Woken
Yes same error happenHi
In your project root directory run this rm -rf node_modules && yarn cache clean && yarn and then try to yarn start againWoken
S
4

All right, look carefully at this:

{
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
  1. errno: 'ENOENT' means the file or directory is not found
  2. path: 'cmd' denotes the executable cmd was not found locally or globally while spawning process cmd via Node.js
  3. Now, I don't want to go into details. Just know that your operating system needs to keep track of some variables which can be accessed globally. One of such variable is called $PATH. The executables inside directories mentioned in the $PATH can be accessed from anywhere on your system.
  4. Here, 'C:\Windows\system32' is a path where windows keeps some critical executables. cmd.exe is one of them. Somehow the path was deleted from the $PATH variable. In order to fix the problem, an easy solution is:
    • Go to start-menu -> search and type environment variables and open it
    • There will be a variable named PATH. Append C:\Windows\system32 to it and press OK. If you're on Windows 7 or below, add a semi-colon ; before it
    • Restart your terminal or IDE or code editor and try running the app. See if the error comes again
Stir answered 7/5, 2020 at 21:21 Comment(1)
tnx alot it solved my problem i don't think problem is in environment variablesHi
P
3

PROBLEM

It seems to install babel changed many nodes, yet it did NOT update the yarn.lock and package.json files accordingly


SOLUTION

yarn info 

Then run

 yarn upgrade 

Then

yarn add yarn
Predigest answered 7/5, 2020 at 21:26 Comment(1)
what errors did you get initially?Stir
C
0

I faced this issue and tried almost all solution in the net, for 5 hours, I was struggling but at last I ran into this solution it it solved thi issue.

simply try this: $ npm install --save --save-exact [email protected]

this should work.

Caramelize answered 21/7, 2023 at 12:14 Comment(0)
C
-1

I've just restarted the terminal and yarn start' worked for me.

I'm using Ubuntu 18.04. I've tried the solutions given in the following posts, but they didn't help.

Cream answered 14/7, 2020 at 5:2 Comment(1)
what errors did you get initially?Stir
T
-1

I followed the above guidelines and the only following worked for me

yarn info which actually failed then I run => yarn upgrade which took 5 minutes or more to complete then finally I run => yarn add yarn after this, I was able to start my server successfully by running my own script yar

Tallith answered 29/1, 2021 at 9:40 Comment(2)
what errors did you get initially?Stir
It was the exact same error @Mohammadreza Mahjoob asked up, later I realized it happens quiet commonlyTallith
F
-1

Here's what worked for me:

  1. Check if your user has administration privileges
  2. If not, then log in the PC's admin account
  3. Press "Win + R" then
  4. Type "control userpasswords2" and press enter
  5. In the Users tab select your user and click "Properties"
  6. Then, mark the Administrator option and click OK
  7. Finally, log off and try again.
Foamflower answered 4/10, 2021 at 16:34 Comment(2)
what errors did you get initially?Stir
The same as the OP. That's why I just posted the answerFoamflower
B
-1

I managed to fixed it Yarn "Failed with errors" with the following. (Source)

> yarn install
> npm install -g yarn
> yarn set version berry

Commit your changes:

> git status
> git add .
> git commit -m "upgraded yarn"

Run Yarn :

> yarn -v
3.2.4
> yarn install
Bicker answered 2/11, 2022 at 0:2 Comment(1)
what errors did you get initially?Stir

© 2022 - 2024 — McMap. All rights reserved.