react-native transform error on default AwesomeProject (unknown corruption from fresh reinstall)

Created on 19 Aug 2017  路  12Comments  路  Source: facebook/react-native

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

yes

Environment

Windows 10 ver 15063.540

react-native-cli: 2.0.1

react-native: 0.47.1

node v6.11.2

not using yarn

  • Development Operating System:

android-studio ver 2.3.3

  • Build tools:

Steps to Reproduce

(Write your steps here:)

react-native init AwesomeProject

cd AwesomeProject
[standard project directory is found. have been developing for approx 8 days. previous various error types which managed to debug and resolve. This is different.]

react-native run-android

Expected Behavior

expected standard AwesomeProject to load.

Actual Behavior

Previously had react-native running nicely, don't recall changing anything, then this error which has proved impossible to clear.environment Windows 10 react-native-cli: 2.0.1 react-native: 0.47.1 node v6.11.2fresh install of node.js after uninstalling previous versions and removing all node and npm directories from paths. fresh install of react-native as per聽https://facebook.github.io/react-native/docs/getting-started.htmlreact-native init AwesomeProject cd AwesomeProject react-native run-androidalso triednpm i -g react-native-git-upgradereact-native-git-upgradereboot, new project, uninstall node, reinstall node, reinstall react-native, new project.still same problem.repeated with react-native-git-upgrade v0.47.0 Wondering if I should try downgrading to an earlier version. Weird thing is it was working a 2 days ago on react-native version downloaded and installed 8-9 days ago.Repeatedly getting same error as below. lost too much time on this. really hurts.The development server returned response error code: 500URL:聽http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=falseBody: {"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

-->
red error screen on android studio android emulator
no additional error info via external debugger.

have tried

npm i -g react-native-git-upgrade

react-native-git-upgrade

and

react-native-git-upgrade v0.47.0

always the same problem.

Reproducible Demo

https://snack.expo.io/SJz9BMSdW

NB: above example with all stylsheet references removed and simplified to most basic hello world.

have checked previous path settings from previous installs were removed priot to reinstalls.

really at a loss here. Don't know what else I can possibly check.

nb: have choco installed, I think previous install did not use choco to install nodejs, uninstall was without using choco.
checked choco uninstall nodejs : said nodejs not installed prior to reinstalling without choco.

just bought a new laptop and really not enjoying this. also wondering if problems are less on a linux based dev environment.

Stale

Most helpful comment

This was happening to me earlier. The following lines solved the problem for me (Windows 10). However, for anyone on OSX, this might require extra work for the same problem. This made me have to install yarn since I didn't have it earlier.

yarn remove babel-preset-react-native 

yarn add [email protected]

All 12 comments

This was happening to me earlier. The following lines solved the problem for me (Windows 10). However, for anyone on OSX, this might require extra work for the same problem. This made me have to install yarn since I didn't have it earlier.

yarn remove babel-preset-react-native 

yarn add [email protected]

wow. thanks for the fast answer.

This worked.

Everything is wonderful again.

also: my first issue raised on a large package. achievement unlocked. :)

wow, @bchehraz thank you! I've been staring at a red simulator for about a week now.

@bchehraz Where am I supposed to run the commands? within the project folder or inside node_modules?

P.S. got this fixed from comments in this issue.

Basically, update package.json (set --> "babel-preset-react-native": "2.1.0"). and delete node_modules folder and run the following commands in react-native-project folder:
$ npm install
$ npm start -- --reset-cache
$ react-native run-android

@divyakoshy I actually needed those 3 commands but for a different reason. My ESLint started to tell me my import statements were reserved-- and the "react-native run-android" command stopped working altogether. It was strange.

Anyway, I followed what you said and it fixed my problem. 馃槃

@bchehraz How did you get the ESLint stuff working. Im using webstorm and it is now suffering from amenesia about ES6 after I ran these commands ? Any help will be really appreciated.

@Almjz Give me more details. What's working and what's not working? Are there import statements that are now invalid? Can you still run react-native commands like run-android?

@bchehraz Yes imports statments and anything es 6 is flagged as a warning as reserved word but react native run-ios works okay

@bchehraz thanks for the answer! I'm running on OSX, had to install yarn but it worked. Simulator works perfectly now

Also, for those who don't want to use Yarn. The babel-preset-react-native version by default is 2.0.1. So just upgrade to 2.1.0 and that should fix it also :)

@bchehraz thanks so much for the solutions. It work like a charm!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

This was hepful for me too. Thank you

Was this page helpful?
0 / 5 - 0 ratings