Eli
Eli

Reputation: 369

TransformError when running React Native Getting Started project (iOS)

I'm having trouble getting the React Native Getting Started project to run.

I followed this guide: https://facebook.github.io/react-native/docs/getting-started.html

When I try to run the project from Xcode, the packager gets to " transform" then an error appears in the simulator.

TransformError: Projects/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/prelude_dev.js: Unknown plugin "node-env-inline"

Here are my versions:

OS X Yosemite 10.10.1
Node 4.2.1
Xcode 6.4
React Native 0.12.0

Upvotes: 3

Views: 4270

Answers (4)

Shaun
Shaun

Reputation: 3895

Had this same problem. I had a ~/.babelrc that was mucking everything up. I tried everything I could find

  1. rm -rf node_modules
  2. npm cache clean
  3. changed versions of node
  4. npm install

Finally... the solution for me was:

sudo lsof -n -i4TCP:8081 then kill the process and rerun react-native run-ios

Upvotes: 2

Yuki Tanaka
Yuki Tanaka

Reputation: 225

It is caused by bug in babel-preset-react-native. Although solutions already provided here reinstall modules, package.json is still pointing to 3.0 of babel-preset-react-native and doesn't help you.

To solve this problem, I think you need to update package.json to point babel-preset-react-native to 2.1.

"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"babel-preset-react-native": "2.1.0"
},

See above, now babel-preset-react-native points to 2.1.0. Then,

rm -rf node_module
npm cache clean
npm i

And restart whichever android or ios. At least, this worked for me.

Upvotes: 0

Efrain Sanjay Adhikary
Efrain Sanjay Adhikary

Reputation: 326

Go to your root folder in command line

cd appName

Now you have to run the packager

react-native start

or

npm start

Run the app on the simulator

Android

react-native run-android

iOS

react-native run-ios

you should keep this terminal open running while developing your app

Upvotes: 0

Melih Mucuk
Melih Mucuk

Reputation: 7066

Delete node_modules directory, running npm cache clean, then npm i again. And you have to restart the packager.

Upvotes: 1

Related Questions