Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Command run-ios unrecognized after adding typescript modules #22

Open
JakeXu opened this issue Jan 10, 2018 · 4 comments
Open

Command run-ios unrecognized after adding typescript modules #22

JakeXu opened this issue Jan 10, 2018 · 4 comments

Comments

@JakeXu
Copy link

JakeXu commented Jan 10, 2018

Follow the guide, I get the below package.json:

{
  "name": "one",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.52.0"
  },
  "devDependencies": {
    "@types/enzyme": "^3.1.6",
    "@types/jest": "^22.0.1",
    "@types/react": "^16.0.34",
    "@types/react-native": "^0.51.9",
    "@types/react-test-renderer": "^16.0.0",
    "babel-jest": "22.0.4",
    "babel-preset-react-native": "4.0.0",
    "enzyme": "^3.3.0",
    "jest": "22.0.5",
    "react-addons-test-utils": "^15.6.2",
    "react-dom": "^16.2.0",
    "react-test-renderer": "16.2.0",
    "ts-jest": "^22.0.1",
    "typescript": "^2.6.2"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/babel-jest",
      "\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    "testPathIgnorePatterns": [
      "\\.snap$",
      "<rootDir>/node_modules/",
      "<rootDir>/lib/"
    ],
    "cacheDirectory": ".jest/cache"
  }
}
react-native -v

react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory

When I run this command line:

npm install --save-dev @types/jest @types/react @types/react-native @types/react-test-renderer

Then I run

react-native run-ios

got the tips:


Command `run-ios` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.

How should I do for it? Everybody can give me some suggestions, Thank you in advance!

@HofmannZ
Copy link

Hi,

Try npm install from the root of your project, seems like react-native is not installed.

@JakeXu
Copy link
Author

JakeXu commented Jan 23, 2018

I have found the solution, but I don't know why?
After running react-native init project-name , you MUST run the below command FIRST,

npm remove jest -D
npm i jest -D

Then, follow the manual, everything will be ok, work fine for you!
It costs me so much time!!!

@VenkataVamsi1991
Copy link

VenkataVamsi1991 commented Apr 11, 2019

Hi @JakeXu I have done what you have said

npm remove jest -D
npm i jest -D
and went to the project and done run-its as react-native run-its
but got same error

my project is git clone https://github.com/tassdr/react-native-template.git

downloaded there and trying to run in my macOS but error remains same

Admins-MacBook-Pro:react-native-template admin$ react-native run-ios
error iOS project folder not found. Are you sure this is a React Native project?. Run CLI with --verbose flag for more details.
Admins-MacBook-Pro:react-native-template admin$

please help me

@JeevaS0722
Copy link

Try this Cmd wrok for me
npx react-native run-ios

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants