将 RN 项目从 0.46.4 升级到 0.60.0 并在 VSCode 结果中运行 无法从任何承诺中获得履行价值,所有承诺都被拒绝



刚刚使用 yarnnpm将我的React-Native项目从0.46.4升级到0.60.0,并在错误之后使用Visual Studio代码结果运行。

[错误]错误:无法从任何承诺中获得满足价值,所有承诺均被拒绝。

这是我的旧package.json

{
  "name": "ShoppingApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "native-base": "2.2.1",
    "react": "16.0.0-alpha.12",
    "react-native": "0.46.4",
    "react-native-grid-view": "https://github.com/lucholaf/react-native-grid-view.git",
    "react-native-scalable-image": "https://github.com/ihor/react-native-scalable-image.git",
    "react-native-tabbar-bottom": "^1.0.4",
    "react-native-numeric-input": "^1.8.0",
    "react-navigation": "https://github.com/Maxeh/react-navigation.git",
    "rn-viewpager": "https://github.com/zbtang/React-Native-ViewPager.git"
  },
  "devDependencies": {
    "babel-jest": "21.0.0",
    "babel-preset-react-native": "3.0.2",
    "jest": "21.0.1",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "jest": {
    "preset": "react-native"
  }
}

和我的新package.json这里

{
  "name": "ShoppingApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "native-base": "^2.12.1",
    "react": "^16.8.6",
    "react-native": "^0.60.0",
    "react-native-grid-view": "^0.4.1",
    "react-native-i18n": "^2.0.15",
    "react-native-numeric-input": "^1.8.0",
    "react-native-scalable-image": "^0.5.1",
    "react-native-tabbar-bottom": "^1.0.4",
    "react-navigation": "^3.11.0",
    "rn-viewpager": "^1.2.9"
  },
  "devDependencies": {
    "babel-jest": "21.0.0",
    "babel-preset-react-native": "3.0.2",
    "jest": "21.0.1",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "jest": {
    "preset": "react-native"
  }
}

当我使用Visual Studio代码构建项目时,显示以下错误。

[错误]错误:无法从任何承诺中获得满足价值,所有承诺均被拒绝。

请让我升级我的项目并构建它。

我找到了升级的方法。我仔细地更改了依赖项,就像以下包装一样。

{
  "name": "ShoppingApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "^16.8.6",
    "react-native": "^0.60.0",
    "react-native-grid-view": "https://github.com/lucholaf/react-native-grid-view.git",
    "react-native-numeric-input": "^1.8.0",
    "react-native-scalable-image": "https://github.com/ihor/react-native-scalable-image.git",
    "react-native-tabbar-bottom": "^1.0.4",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "https://github.com/Maxeh/react-navigation.git",
    "rn-viewpager": "https://github.com/zbtang/React-Native-ViewPager.git"
  },
  "devDependencies": {
    "@babel/core": "^7.5.0",
    "@babel/runtime": "^7.5.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.8.0",
    "eslint": "^6.0.1",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.55.0",
    "react-test-renderer": "^16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

您可以看到,我删除了本机基础和更新的开发依赖项,并添加了babel/core。并再次删除node_modules,纱线或npm。

相关内容

最新更新