error Command failed with exit code 1. when I try to run yarn

Solution 1:

what you need to do is just simple: follow these steps:

  1. rm -rf node_modules
  2. yarn cache clean
  3. yarn
  4. yarn start

Solution 2:

I faced same error and I fixed it by following these steps:

  1. Delete yarn_lock.json or rm -rf yarn_lock.json (if you are Linux/MacOS user)
  2. Delete node_modules/ or rm -rf node_modules/ (if you are Linux/MacOS user)
  3. Follow the instructions to install the latest Yarn package available from here
  4. Try executing following commands in your project root folder:

yarn install and yarn start

In case if the above approach didn't help:

  1. Try to install latest node.js
  2. Remove node_modules/ and lock file
  3. use npm install and npm run-script

Solution 3:

One of the issue that you may face is the server won't start if some other server is running too . For eg. I had XAMP Running and thus my yarn couldn't start itself. Check it once.

Solution 4:

This should work:

yarn add yarn