//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
//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
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
npmfor 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 Toolsand check it。
npm run iosfor 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
npmand the command is from
npm run iosto
yarn run ios. While when I use
yarnI 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!
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