react-native-builder-bob icon indicating copy to clipboard operation
react-native-builder-bob copied to clipboard

Running yarn doesn't work

Open johannbuscail opened this issue 2 years ago • 2 comments

Description

When I initialize a library with npx create-react-native-library app-structure everything works fine, the folder is created. But in the doc, the next step is to run yarn, and when I run it, nothing happens. It stops directly

I tried updating yarn to the latest version and even uninstall and reinstalling it, but it doesn't change anything.

Strangely, when I run npm install instead of yarn, some things are installed but still, if I run npm run example web, nothing happens.

Reproducible Demo

Simply run npx create-react-native-library app-structure, then yarn

johannbuscail avatar Aug 28 '21 06:08 johannbuscail

Description

When I initialize a library with npx create-react-native-library app-structure everything works fine, the folder is created. But in the doc, the next step is to run yarn, and when I run it, nothing happens. It stops directly

I tried updating yarn to the latest version and even uninstall and reinstalling it, but it doesn't change anything.

Strangely, when I run npm install instead of yarn, some things are installed but still, if I run npm run example web, nothing happens.

Reproducible Demo

Simply run npx create-react-native-library app-structure, then yarn

Hi ngab. I assume you were running this on windows, because it runs fine on MacOS. The problem is that somehow nodejs behaves differently on windows, it can't spawn the child_process automatically. Do the following:

  • Go to /scripts directory in the root project
  • Edit the bootstrap.js, pass the key { shell: true }

So the options would be like this: const options = { cwd: process.cwd(), env: process.env, stdio: 'inherit', encoding: 'utf-8', shell: true, };

Then run yarn command again, it would work normally

a-elcesar avatar Sep 13 '21 11:09 a-elcesar

Can you add this in the readme, 2 hours i was clueless.

sunel avatar Sep 21 '21 12:09 sunel

I think, a pr should be opened for this.

lfabl avatar Oct 28 '22 17:10 lfabl

@lfabl Is this issue still happening for you? It seems to be already resolved: https://github.com/callstack/react-native-builder-bob/blob/3bad82db17675d366db18d8eb5d137f5d00802aa/packages/create-react-native-library/templates/common/scripts/bootstrap.js#L15

MateWW avatar Nov 16 '22 09:11 MateWW

Yes, i solved with shell = true;

lfabl avatar Nov 18 '22 15:11 lfabl