简体   繁体   中英

React Native setup Mac M1 (Air)

I follow this guy's tutorial https://youtu.be/MJEcookWYUI?t=686

I get errors after the command on the video

admin@MacBook-Air:~/Demo$ npm run ios
npm ERR! missing script: ios   
npm  ERR! A complete log of this run can be found in:
npm ERR!     /Users/admin/.npm/_logs/2022-09-12T22_06_04_217Z-debug.log

I searched many websites, tried to do everything i saw but i nothing worked.

Please help

try this

"scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
  }

Add this to package.json file in case it isn't there. after adding run npx react-native run-ios

check on your package.json script:

"android": "react-native run-android",
"ios": "react-native run-ios",

and try to running with npx react-native run-ios or yarn ios

Usually we can open project with xcode and run. It will automatically start metro server locally.

My suggestion open your project with xcode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM