React-native: Packager doesn't start after upgrading to 0.46.0

Created on 6 Jul 2017  路  14Comments  路  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: 0.46.0
  2. node -v: v4.0.0
  3. npm -v: 4.2.0
  4. yarn --version (if you use Yarn): 0.23.4

Then, specify:

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

Steps to Reproduce

  1. Run project from Xcode
  2. Terminal launches to start packager, then fails

Or:

  1. Run react-native start
  2. Packager fails

Expected Behavior

Packager starts; compiles project

Actual Behavior

I get this error:

/Users/alexduckmanton/AppsLocal/project_name/node_modules/metro-bundler/build/lib/TerminalClass.js:141
    this._nextStatusStr = util.format(format, ...args);
                                              ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:413:25)
    at Module._extensions..js (module.js:452:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/alexduckmanton/AppsLocal/project_name/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/alexduckmanton/AppsLocal/project_name/node_modules/react-native/local-cli/server/runServer.js:18:18)
    at Module._compile (module.js:434:26)
Locked

Most helpful comment

I had this problem this morning. You need to upgrade your node.js to the latest version which is v6 i believe. It will work fine then.

All 14 comments

Maybe babelrc file is missing , try to add a file named .babelrc with the following:

{
  "presets": ["react-native"],
  "plugins": ["transform-function-bind"]
}

Very similar problem for me when creating a blank 0.46 app.
Command I run on a mac:
cd $(mktemp -d) && react-native init FooBar && cd FooBar && node_modules/react-native/scripts/packager.sh

Error output from packager:

/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
        throw e;
        ^

ReferenceError: Unknown plugin "transform-runtime" specified in "/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/regenerator-transform/package.json" at 0, attempted to resolve relative to "/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/regenerator-transform" (While processing preset: "/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-preset-react-native/index.js")
    at /private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-register/lib/node.js:103:45)
    at loader (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/private/var/folders/1_/zbm5sxxj7rbgbvxqv5xdy7pr0000gp/T/tmp.twkrqC9i/FooBar/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)

I had this problem this morning. You need to upgrade your node.js to the latest version which is v6 i believe. It will work fine then.

Same problem

Not sure why my comment was down voted. Your Node and npm are both too old to work with React-Native 0.46. React-Native 0.46 uses ES6. The error is on a ES6 operator. Node V4 does not know what this is. So you need to upgrade to the latest node and npm which uses this feature.

@jibberilins is correct.

Cheers guys. @jibberilins that did the trick, thanks.

I'm using node 6.11.0 and I have the same issue

/Users/jroa/Documents/gearTienda/node_modules/metro-bundler/build/lib/TerminalClass.js:141
    this._nextStatusStr = util.format(format, ...args);
                                              ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Module._extensions..js (module.js:416:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/jroa/Documents/gearTienda/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/jroa/Documents/gearTienda/node_modules/react-native/local-cli/server/runServer.js:18:18)
    at Module._compile (module.js:409:26)
Process terminated. Press <enter> to close the window

yes, i have the same issue
before, i work fine with react-native 0.42,
My environment
node -v : v4.2.2
npm -v : 3.7.3

npm WARN [email protected] requires a peer of [email protected] but none was installed.
/Users/betapcode/workspace/reactnative/test01/node_modules/metro-bundler/build/lib/TerminalClass.js:141
    this._nextStatusStr = util.format(format, ...args);
                                              ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Module._extensions..js (module.js:442:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/betapcode/workspace/reactnative/test01/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/betapcode/workspace/reactnative/test01/node_modules/react-native/local-cli/server/runServer.js:18:18)
    at Module._compile (module.js:435:26)

Is this still happening with React Native 0.46.1?

yes. same issue for me.
i just update my nodejs 6. Noe it works fine for me

I have the same issue
react-native-cli: 2.0.1
react-native: 0.46.1
nodejs: 6.11.0
npm v3.10.10

Hi @betapcode. You need to upgrade your node to v6 and your react. React-Native 0.46.1 needs the latest React version. @tavriaforever I would say check your React version as well because since you have the latest React-Native version, your React version needs to be up to date also.

If anyone is still running into this, please open a new issue and posted _detailed_ steps on how you upgraded to the new React Native version. As in, did you use react-native upgrade or did you just change the version number in the package, did you use npm to update your dependencies, and so on.

If you're using nvm, make sure to note what version it uses by default when filling out your issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anchetaWern picture anchetaWern  路  3Comments

josev55 picture josev55  路  3Comments

janmonschke picture janmonschke  路  3Comments

grabbou picture grabbou  路  3Comments

WG-Com picture WG-Com  路  3Comments