Raptor
Raptor

Reputation: 54222

React Native package.json versions

I have a React Native project created a month ago, using create-react-native-app command.

The package.json contents are as follow:

{
  "name": "TestApp2",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.1.0",
    "jest-expo": "~19.0.0",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^19.0.0",
    "react": "16.0.0-alpha.12",
    "react-native": "^0.46.1"
  }
}

When I create a project today, the package.json is as follow:

{
  "name": "NewApp",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.5.0",
    "jest-expo": "^21.0.2",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^21.0.0",
    "react": "16.0.0-alpha.12",
    "react-native": "^0.48.4"
  }
}

Please note that the versions of react-native-scripts, jest-expo and expo are different. My question is, how can I upgrade the version? Should I just change the version number manually?

I tried to use:

$ npm install -g react-native-git-upgrade
$ react-native-git-upgrade

But it does not upgrade the versions.

I also tried:

$ npm update
$ react-native upgrade

But both commands don't update the versions.

Upvotes: 3

Views: 9051

Answers (3)

Anton Layla
Anton Layla

Reputation: 21

Because you are using expo, you can also use its upgrade functions.

So just run expo upgrade in the root directory, look here expo doc

Upvotes: 2

rendi saepul bahri
rendi saepul bahri

Reputation: 96

{

"react-native-scripts": "1.1.0",
"jest-expo": "~19.0.0",

},

try edit with new version,and run "rm -rf node_modules && npm install" in your project!

Upvotes: -1

Justin Niessner
Justin Niessner

Reputation: 245429

Just manually update the versions in your package.json file and the re-run npm install.

Upvotes: 2

Related Questions