0

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

Iva
  • 2,447
  • 1
  • 18
  • 28
Thanos
  • 7
  • 5

2 Answers2

0

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

Iva
  • 2,447
  • 1
  • 18
  • 28
  • before adding this to .json i run the npx react-native run-ios and i had error. (see comment above" .. So i added it and i run it and now i get " error: unknown command 'run-ios' " – Thanos Sep 13 '22 at 09:39
  • npm install --save react-native@latest – Iva Sep 13 '22 at 09:44
  • or try to run react-native run-ios – Iva Sep 13 '22 at 09:45
  • are you using expo or react-cli ? How did you created your project ? – Iva Sep 13 '22 at 09:46
  • i think i used react-cli . i followed the tutorial of the guy's on youtube. also run react-native run ios doesnt work ........ would be that easy for you if we can talk via a chat app so you help me out? – Thanos Sep 13 '22 at 10:06
  • npx react-native init ProjectName --version 0.68.2 create project and then npx react-native run-ios. This should work – Iva Sep 13 '22 at 10:33
  • $npx react-native init ProjectName --version 0.68.2 and the results ✖ Downloading template error Error: Command failed: npm install --save --save-exact react-native@0.68.2 npm ERR! cb.apply is not a function npm ERR! A complete log of this run can be found in: npm ERR! /Users/admin/.npm/_logs/2022-09-13T11_06_19_276Z-debug.log – Thanos Sep 13 '22 at 11:07
  • stackoverflow.com/a/63256830/6654562 – Iva Sep 13 '22 at 11:15
0

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

Ebe toni
  • 9
  • 3
  • I run the command "npx react-native run ios" and i get .. error iOS project folder not found. Are you sure this is a React Native project?. – Thanos Sep 13 '22 at 09:34
  • did u install correctly? check the folder ios in root project is existing or not. try to upgrade the react native project with "npx react-native upgrade" in your root project directory – Ebe toni Sep 13 '22 at 10:11
  • $cd myproject $npx react-native upgrade $error Command failed: npm info react-native version $npm ERR! cb.apply is not a function – Thanos Sep 13 '22 at 10:17
  • https://stackoverflow.com/a/63256830/6654562 – Iva Sep 13 '22 at 10:19