之前react-native一切正常运行,我不记得做任何更改,但现在出现了无法解决的错误。
环境 Windows 10 react-native-cli: 2.0.1 react-native: 0.47.1 node v6.11.2
卸载之前的node.js版本并从路径中删除所有node和npm目录后进行全新安装。 按照https://facebook.github.io/react-native/docs/getting-started.html上的步骤进行全新安装react-native。
react-native init AwesomeProject cd AwesomeProject react-native run-android
也尝试过
npm i -g react-native-git-upgrade
react-native-git-upgrade
重启,新建项目,卸载node,重新安装node,重新安装react-native,新建项目。
仍然是同样的问题。
重复使用react-native-git-upgrade v0.47.0 我在想是否应该尝试降级到早期版本。奇怪的是,它在8-9天前下载和安装的react-native版本上运行良好。
一直得到以下相同的错误。已经浪费了太多时间。真的很伤心。
开发服务器返回响应错误码:500
URL: http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false
Body: {"message":"TransformError: D:\blah\AwesomeProject\index.android.js: Unexpected token ) (While processing preset: \"D:\\blah\\AwesomeProject\\node_modules\\babel-preset-react-native\\index.js\")","type":"TransformError","lineNumber":0,"description":"","errors":[{"description":"","lineNumber":0}]} processBundleResult BundleDownloader.java:170 access$100 BundleDownloader.java:39 onResponse BundleDownloader.java:139 execute RealCall.java:135 run NamedRunnable.java:32 runWorker ThreadPoolExecutor.java:1133 run ThreadPoolExecutor.java:607 run Thread.java:761