Create-react-native-app: Starting App Fails: Getting "sh: react-native-scripts: command not found"

Created on 4 Nov 2017  路  5Comments  路  Source: expo/create-react-native-app

Please make our job easier by filling this template out to completion. If you're requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.

Description

I Tried with NPM (I had v5.5.1) and Yarn. After neither worked, I uninstalled yarn, npm, and node, and installed node@v6 and npm@v4. I only rolled back node, after only rolling back npm didn't work.

After installing create-react-native-app I create a basic app and run "npm start"

Expected Behavior

ran "npm start" Expected it to start the app

Observed Behavior

What actually happened when you performed the above actions?

I got an error and the app didn't start

If there's an error message, please paste the full terminal output and error message in this code block:

> [email protected] start /Users/admin/Data/App Design/2017/React Native Basics: Currency Converter App/CurrencyConverter
> react-native-scripts start

sh: react-native-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `react-native-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/admin/.npm/_logs/2017-11-04T21_24_09_928Z-debug.log

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Operating system: Mac OS version 10.12.6
  2. Phone/emulator/simulator & version:

Reproducible Demo

Please provide a minimized reproducible demonstration of the problem you're reporting.

I'm not sure how to provide a demo for this case.

Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.

Most helpful comment

This may happen when you've messed with the node_modules folder or dependencies directly. In my case, it was after ejecting and going back to master to an unejected version. Make sure you run yarn install before running yarn start again.

All 5 comments

Update:

I reinstalled yarn and tried creating a new app from my home directory. running "yarn start" from there actually worked.

trying to create an app in a different directory and running it with yarn failed though.

Here's the error:

yarn run v1.2.1
$ react-native-scripts start
/bin/sh: react-native-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I all of sudden have the same issue without touching the repository. Very strange.

ok, it was an issue with yarn, not react-native-scripts.

I needed to reinstall yarn in order to solve the issue (yarn 1.3.2)

In my case I had an old copy of yarn which I had installed via npm, as well as a good copy installed via homebrew. My shell was using the old yarn which could not find the scripts. (You can check your yarn location with which yarn.)

The solution was to uninstall the copy of yarn that I had installed via npm:

npm uninstall -g yarn

And then my shell would use the good version of yarn instead.

This may happen when you've messed with the node_modules folder or dependencies directly. In my case, it was after ejecting and going back to master to an unejected version. Make sure you run yarn install before running yarn start again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FezVrasta picture FezVrasta  路  3Comments

liujb picture liujb  路  5Comments

FezVrasta picture FezVrasta  路  3Comments

anp picture anp  路  3Comments

WeslleyNasRocha picture WeslleyNasRocha  路  4Comments