3

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.

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Any alternative way to let npm update upgrade the versions specified in package.json as well?
2

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

1 Comment

at the moment the question was asked, the command did not exist yet. But yes, it should be the correct answer for modern days.
-1

{

"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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.