Search code examples
windowsreact-nativecommand-lineyarnpkg

Yarn not working on windows + react-native-builder-bob, not even showing an error message


I'm developing a lib for common use in a couple react-native projets and for that I'm using a scaffolding lib recommended on react-native official docs page. This is what the company uses, so I have to use it too.

For some reason, running yarn from the command line on my windows machine does absolutely nothing, not even outputs an error message. The company had to lend me a Mac so I can work on the lib. I'm not saying just yarn commands like trying to install packages, even running yarn --version gives me no output, it just halts.

That's the strange part, it only happens if I'm running yarn from inside the project's folder. If I run yarn on my windows machine from some arbitrary folder or any project that does not uses react-native-builder-bob, yarn works normally. I can install packages, check the version, run commands, everything ok. That makes me think it's not something wrong with my yarn installation. Both the mac and my windows have installed version 1.22.10.

I dug through the issues on bob's github but could find nothing regarding windows and yarn. I also have a spare SSD which I tried running a fresh windows install, setting up my work environment again and still got the same issue.

I really want to use my windows machine to work on this project since it's way more powerful than the mac they lend me. Any help would be much appreciated


Solution

  • I had the same problem. Fixed it by changing options object scripts/bootstrap.js

    const options = {
      cwd: process.cwd(),
      env: process.env,
      stdio: 'inherit',
      encoding: 'utf-8',
      shell: true //add this property
    };
    

    I'm assuming you have already installed yarn and node.