我使用create-react-native-app命令创建了一个一个月前创建的React本机项目。
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-scripts、jest-expo和expo的版本是不同的。我的问题是,我如何升级版本?我应该手动更改版本号吗?
我试着用:
$ npm install -g react-native-git-upgrade
$ react-native-git-upgrade但它并没有升级版本。
我也试过:
$ npm update
$ react-native upgrade但这两个命令都不更新版本。
发布于 2017-09-29 03:25:48
只需手动更新package.json文件和重新运行的npm install中的版本即可。
发布于 2021-11-16 11:28:16
因为您使用的是世博,所以您也可以使用它的升级功能。
所以只需在根目录中运行expo upgrade,看这里的世博博士
发布于 2017-09-29 06:59:31
{
"react-native-scripts": "1.1.0",
"jest-expo": "~19.0.0",},
尝试使用新版本编辑,并在您的项目中运行"rm -rf node_modules && npm安装“!
https://stackoverflow.com/questions/46481347
复制相似问题