React-native: [0.46] ReferenceError: Unknown plugin "transform-runtime"

Created on 5 Jul 2017  ·  35Comments  ·  Source: facebook/react-native

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

  1. react-native -v: react-native-cli: 2.0.1 react-native: 0.46.0
  2. node -v: v7.6.0
  3. npm -v: 5.0.3
  4. yarn --version (if you use Yarn): 0.24.6

Then, specify:

  1. Target Platform (e.g. iOS, Android): iOS
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):

Steps to Reproduce

(Write your steps here:)

  1. react-native init
  2. yarn
  3. react-native run-ios

Expected Behavior

Open iOS simulator with the hello world app

Actual Behavior


Packager fails

/Users/xx/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
        throw e;
        ^

ReferenceError: Unknown plugin "transform-runtime" specified in "/Users/xx/test/node_modules/regenerator-transform/package.json" at 0, attempted to resolve relative to "/Users/xx/test/node_modules/regenerator-transform" (While processing preset: "/Users/xx/test/node_modules/babel-preset-react-native/index.js")
    at /Users/xx/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/Users/xx/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/xx/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/xx/test/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/xx/test/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/xx/test/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/xx/test/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
Process terminated. Press <enter> to close the window


Reproducible Demo

init a new project

Locked

Most helpful comment

Doing this :

rm -rf .babelrc

solves the issue temporarily

All 35 comments

I have the exact same issue when running run-android, while run-ios is working fine.

The problem occurs on newly generated projects, my existing projects run fine.

+1

Same, run-ios

+1

+1

I also have the same issue.
This is a temporary fix because I changed previous react-native package.json.

  1. delete node_modules
  2. change package.json
...
 "dependencies": {
        "react": "16.0.0-alpha.12",
    "react-native": "0.45.1"
},
"devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "2.0.0",
    ...
},
...
  1. do npm install
  2. react-native run-ios

Doing this :

rm -rf .babelrc

solves the issue temporarily

same issue here. And @javierM84 's solution works for me.

Same here!

+1

Worked for me too!

@Nismit worked to mee

+1

Same. Reproduced on 0.46.0, was on 0.45.1 without issue. On MacOS, running react-native run-ios > React Packager terminal output:

/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
        throw e;
        ^

ReferenceError: Unknown plugin "transform-runtime" specified in "/Users/<user>/Documents/code/<RN_project_name>/node_modules/regenerator-transform/package.json" at 0, attempted to resolve relative to "/Users/<user>/Documents/code/<RN_project_name>/node_modules/regenerator-transform" (While processing preset: "/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-preset-react-native/index.js")
    at /Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/<user>/Documents/code/<RN_project_name>/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
Process terminated. Press <enter> to close the window

Tried removing .babelrc and run-ios terminates on a different babel plugin I'm using, idx:

/Users/<user>/Documents/code/<project>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180
          throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
          ^

ReferenceError: Unknown plugin "idx" specified in "/Users/<user>/Documents/code/.babelrc" at 0, attempted to resolve relative to "/Users/<user>/Documents/code"
    at /Users/<user>/Documents/code/<project>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/Users/<user>/Documents/code/<project>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/<user>/Documents/code/<project>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/<user>/Documents/code/<project>/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/<user>/Documents/code/<project>/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/<user>/Documents/code/<project>/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/<user>/Documents/code/<project>/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
Process terminated. Press <enter> to close the window

Closing the terminated process and booting up the packager via react-native start seems to work

@javierM84 's solution works!

+1
Just happened for every new project I create today with 0.46. All current projects work perfectly.
workaround: Running packager while at the new project folder using react-native start

Manual react-native start works for me too after building everything else, as a workaround.

But the usual and complete react-native run-ios workflow is busted and still need fixing, obviously. The other workarounds posted previously (with .babelrc and such) doesn't work for me.

This is happening on an existing project I just upgraded to 0.46.

I got it working by deleting .babelrc as per @javierM84

@fungilation it works!

+1

+1

Same issue, + 1.

I change "babel-preset-react-native" back to version "2.0.0" and everything is working.

+1

I got this problem too.
If I delete .babelrc I will encounter this problem #14209
So I checked regenerator-transform/package.json found

"devDependencies": {
    "babel-cli": "^6.9.0",
    "babel-plugin-transform-runtime": "^6.9.0",
    "babel-preset-env": "^1.2.2"
  },

babel-clibabel-plugin-transform-runtimebabel-preset-env haven't installed in node_modules, so I installed them all.
Then I got this guy says Couldn't find preset "es2015" relative to directory ...blabla, so I installed babel-preset-es2015
After that I reencountered #14209. T_T

Can someone who has working version of react native 0.46 project paste a package.json file?

+1

my working package for react native 0.46.0
https://gist.github.com/namdq1969/f82b7ac8157b2db8f6bdf5e19463d8e7

@tomislavHonig @grabbou my package.json:

{
  "name": "<name>",
  "version": "0.0.1",
  "private": true,
  "eslintConfig": {
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
      }
    },
    "env": {
      "browser": true,
      "node": true
    },
    "plugins": [
      "react",
      "react-native"
    ],
    "rules": {
      "comma-dangle": [
        2,
        "always-multiline"
      ],
      "semi": [
        2,
        "never"
      ],
      "react-native/no-unused-styles": 2,
      "react-native/split-platform-components": 2
    }
  },
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "babel-plugin-idx": "^1.1.0",
    "bugsnag-react-native": "^2.2.3",
    "he": "^1.1.0",
    "lodash": "^4.17.2",
    "moment-timezone": "^0.5.10",
    "node-summary": "file:../node-summary/",
    "react": "16.0.0-alpha.12",
    "react-native": "0.46.0",
    "react-native-blur": "^3.1",
    "react-native-code-push": "3.0.1-beta",
    "react-native-firebase-analytics": "^3.0.0",
    "react-native-fit-image": "^1.4.8",
    "react-native-highlight-words": "^1.0.0",
    "react-native-keep-awake": "^2.0.4",
    "react-native-linear-gradient": "^2.0.0",
    "react-native-modalbox": "^1.3.8",
    "react-native-notification": "^2.0.0",
    "react-native-orientation": "file:../react-native-orientation-RN0.40/",
    "react-native-parallax-scroll-view": "^0.19.0",
    "react-native-safari-view": "^2.0.0",
    "react-native-status-bar-size": "^0.3.2",
    "react-native-swiper": "^1.5.4",
    "react-native-tooltip": "^5.0.0",
    "react-native-tts": "^1.3.0",
    "react-native-vector-icons": "^4.1.1",
    "react-native-webview-bridge": "file:../react-native-webview-bridge-RN0.40/",
    "react-redux": "^5.0.1",
    "realm": "^1.3.1",
    "redux": "^3.6.0",
    "redux-thunk": "^2.1.0"
  },
  "devDependencies": {
    "redux-logger": "^3.0.6"
  }
}

.babelrc:

{
  "presets": ["react-native"],
  "plugins": ["idx"]
}

@javierM84 thanks it works for me on RN 0.46

No need to delete Babel config - it's important part of the app. Restarting the Terminal and calling the react-native start command help me.

I managed to solve the issue temporarily without removing .babelrc by

  1. install [email protected]
  2. rm -rf node_modules/react-native/node_modules/metro-bundler

14530 has more details on this

No need for manual install or deletes. With yarn, all you need is yarn upgrade. https://github.com/facebook/react-native/issues/14530#issuecomment-313747461

Was this page helpful?
0 / 5 - 0 ratings