//Make sure you have npm, if not install it.
brew install npm
//Install create-react-native-app
npm install -g create-react-native-app
//Install react-native-cli
npm install -g react-native-cli
create-react-native-app init projectName
//Move into your project directory
cd projectDir
//Launch your project
react-native run-ios
Sublime
and others.//The description is
21:37:47: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
sudo sysctl -w kern.maxfiles=5242880
sudo sysctl -w kern.maxfilesperproc=524288
// Do as the command alert
sudo sysctl -w kern.maxfiles=5242880
sudo sysctl -w kern.maxfilesperproc=524288
-bash: create-react-native-app: command not found
sudo nano /etc/paths
echo $PATH
You will see:
XXX ~ userName$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/share/npm/bin
npm install npm@4 -g
recheck the version of npm
npm -v
npm
for last version and remove it and then rerun the commands above. :AwesomeProject xxx$ npm run ios
> AwesomeProject@0.1.0 ios /Users/.../Desktop/React-native/AwesomeProject
> react-native-scripts ios
下午8:20:47: Starting packager...
下午8:22:16: Starting simulator...
Unable to check Xcode version: Error: Process exited with non-zero code: 1
下午8:22:16: Failed to start simulator:
Unable to verify Xcode and Simulator installation.
Exiting...
Xcode -> Preference -> Location -> Command Line Tools
and check it。npm run ios
for many times at the beginning,I always have a long time waiting for my project to be launched when the command line is stopping at Starting simulator...
as the time is frozen. So I tried to find the answer in the net and find the similar question .Three is a way using yarn
to replace npm
and the command is from npm run ios
to yarn run ios
. While when I use yarn
I have some other questions:
command not found
yarn
, you can see the environment it output. You can write the environment into the file as Question One mentioned and then restart it you can find everything will be ok!React-native
Environment desciption: xxx:~ xx$ npm -v
4.6.1
xxx:~ xx$ node -v
v9.7.1
xxx:~ xx$ react-native -v
react-native-cli: 2.0.1
xxx:~ xx$ yarn -v
1.5.1