react-native绑定失败

时间:2018-08-13 08:42:36

标签: react-native npm

希望您能解决我今天遇到的问题,此刻我完全迷失了。我有一个本机反应项目,昨天一切正常,但是今天我试图启动捆绑器,模拟器等,但是遇到了一个奇怪的错误,却使我完全无所适从。进入这个。

错误消息

error: bundling failed: SyntaxError: Unexpected token, expected { (52:36)
    at Parser.pp$5.raise (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp.expect (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:1749:33)
    at Parser.pp$1.parseClassBody (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:2436:8)
    at Parser.pp$1.parseClass (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:2406:8)
    at Parser.pp$1.parseStatement (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:1843:19)
    at Parser.pp$1.parseBlockBody (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:2268:21)
    at Parser.pp$1.parseTopLevel (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:1778:8)
    at Parser.parse (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:1673:17)
    at Object.parse (/Users/michel.engelen/...<patchToProject>.../node_modules/babylon/lib/index.js:7305:37) [/Users/michel.engelen/...<patchToProject>.../node_modules/react-native/Libraries/Components/Button.js]

随后输入npm start -- --reset-cachereact-native run-ios时,此消息会在终端中弹出。

项目设置/已安装的软件包

这是我在package.json中的依赖项:

"dependencies": {
  "npm": "6.3.0",
  "prop-types": "15.6.2",
  "react": "16.3.1",
  "react-native": "0.55.4",
  "react-native-fontawesome": "5.7.0",
  "react-native-remote-svg": "1.2.0",
  "react-native-splash-screen": "3.1.1",
  "react-navigation": "2.11.2",
  "react-redux": "5.0.7",
  "redux": "3.7.2",
  "redux-thunk": "2.3.0",
  "redux-undo": "1.0.0-beta9-9-7"
},
"devDependencies": {
  "@babel/core": "7.0.0-beta.56",
  "babel-plugin-add-module-exports": "0.2.1",
  "babel-preset-es2015": "6.24.1",
  "babel-preset-react-native": "4.0.0",
  "eslint": "5.3.0",
  "eslint-config-google": "0.9.1",
  "eslint-plugin-import": "2.13.0",
  "eslint-plugin-jsx-a11y": "6.1.1",
  "eslint-plugin-react": "7.10.0",
  "eslint-plugin-react-native": "3.2.1",
  "redux-devtools-extension": "2.13.5"
},

我没有在其上指定范围,因为这几乎总是会导致其他捆绑问题的奇怪错误(尽管这次不是)。

解决此问题的努力(直到现在)

  1. rm -rf node_modules/ package-lock.json
  2. 升级软件包
  3. 从依赖项中删除jest
  4. rm -rf ios/ android/ && react-native eject
  5. 将分支重置为过去确定有效的提交
  6. 在所有这些步骤中,我什至用yarn代替了npm,看看它是否对结果有影响

我什至试图重新启动MacBook,但到目前为止没有任何进展。

我非常希望有人可以帮助我,因为否则我可能必须重做所有事情,这将花费我很多时间。

0 个答案:

没有答案