TransformError when starting a React Native Getting Started project (iOS)

I'm having trouble starting the React Native Getting Started project.

I followed this tutorial: https://facebook.imtqy.com/react-native/docs/getting-started.html

When I try to start a project from Xcode, the packer gets a "conversion", then an error appears in the simulator.

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

Here are my versions:

OS X Yosemite 10.10.1 Node 4.2.1 Xcode 6.4 React Native 0.12.0 

Does anyone know how to solve this?

Any help would be greatly appreciated!

TransformError

+3
source share
4 answers

There was the same problem. I had ~/.babelrc that did all this. I tried everything I could find

  • rm -rf node_modules
  • npm cache clean
  • modified node versions
  • npm install

Finally, the solution for me was:

sudo lsof -n -i4TCP:8081 then start the process and restart react-native run-ios

+2
source

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

+1
source

Go to the root folder on the command line

 cd appName 

Now you need to run the packer

 react-native start 

or

 npm start 

Run the application on the simulator

Android

 react-native run-android 

IOS

 react-native run-ios 

you must keep this terminal open when developing your application

0
source

This is caused by a bug in babel-preset-react-native. Although the solutions already provided here reinstall the modules, package.json still points to 3.0 babel-preset-react-native and does not help you.

To solve this problem, I think you need to update package.json to specify babel-preset-react-native-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 values ​​point to 2.1.0. Then,

 rm -rf node_module npm cache clean npm i 

And restart some Android or ios. At least it worked for me.

0
source

Source: https://habr.com/ru/post/1270945/


All Articles