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

Posted

技术标签:

【中文标题】将 RN 项目从 0.46.4 升级到 0.60.0 并在 VSCode 中运行 结果无法从任何承诺中获得履行价值,所有承诺都被拒绝【英文标题】:Upgrading RN project from 0.46.4 to 0.60.0 and run in VSCode result Can't get fulfillment value from any promise, all promises were rejected 【发布时间】:2019-11-18 11:45:28 【问题描述】:

刚刚使用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 Code 构建项目时,显示以下错误。

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

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

【问题讨论】:

【参考方案1】:

我找到了升级的方法。 我像遵循 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": 
    "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"
  

如您所见,我删除了 native-base 并更新了 dev 依赖项并添加了 babel/core。 并再次删除 node_modules、yarn 或 npm。

【讨论】:

以上是关于将 RN 项目从 0.46.4 升级到 0.60.0 并在 VSCode 中运行 结果无法从任何承诺中获得履行价值,所有承诺都被拒绝的主要内容,如果未能解决你的问题,请参考以下文章

RN 0.62 -- -- 18个重复的臂膀结构符号7

react-native run-android上的React Native错误

[升级到RN 0.62后将不会加载应用程序

error Unexpected token = 从 RN 0.64.2 升级到 0.65.1 之后

将 RN 0.37 升级到 0.41 破坏了在设备上运行的能力

RN升级后未找到`FBLazyVector`的podspec