React Native package.json versions



我一个月前创建了一个反应本机项目,使用create-react-native-app命令。

package.json内容如下:

{
  "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"
  }
}

今天创建一个项目时,package.json如下:

{
  "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"
  }
}

请注意,react-native-scriptsjest-expoexpo的版本不同。我的问题是,如何升级版本?我应该只是手动更改版本号吗?

我尝试使用:

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

但不会升级版本。

我也尝试了:

$ npm update
$ react-native upgrade

但两个命令都不更新版本。

只是手动更新package.json文件中的版本和重新运行的npm install

因为您正在使用Expo,您也可以使用其升级功能。

因此,只需在根目录中运行expo upgrade,请在此处查看博览会doc

{

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

},

尝试使用新版本进行编辑,然后在项目中运行" RM -RF Node_modules& amp; amp; amp; amp; amp; amp; amp; amp;

相关内容

  • 没有找到相关文章

最新更新