Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
added 570 packages in 68.157s
c:\and\test\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] (c:\and\test\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.
at Module._compile (module.js:409:26)
I am facing the same problem from last days and tried all possible solution mentioned on stack over flow + GitHub. This is the first time I am trying to learn React Native. Can some one add some more idea?
Hey, thanks for reporting this issue!
It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.
I am going to close this, but feel free to open a new issue with the additional information provided. Thanks!
I am also new to react native. I followed following steps while installing react-native
npm install -g react-native-clireact-native init AwesomeProject in cmd it doesn't do anything. Command prompt does not shows me anything. It just ready for taking another commandVery similar problem for me yesterday. And I had resolved it by upgrade my node.js version to v6.11.1.
Currently it works for me with node v8.
Update node version on macOS.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Assuming that you are using nvm and multiple versions of node installed, here is the solution:
npm install -g react-native-cli in v6.9.5. v6.9.5 as default by running nvm alias default 6.9.5react-native run-iosThe problem is, you have multiple versions of node installed via nmp and to install react-native-cli you have switched or installed latest version of node, which is not marked as default node to point in nvm yet. When you run react-native run-ios this opens up another new terminal window in which default nvm is not pointed to the node version where you have installed react-native-cli. Just follow the above setup, I hope that should help.
Answered the same here: https://stackoverflow.com/a/45267703/1292050
^ Aliasing solved the issue for me
Thanks @syed-haroon !
I have the same problem
@cxlbus Which Node version are you using? Are you using NVM?
my package.json is
```{
"name": "RNBBS",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",
"react-native-material-kit": "^0.4.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "3.0.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.6"
},
"jest": {
"preset": "react-native"
}
}
I last found some error in babel-preset-react-native
fixed this js file at node_modules/babel-preset-react-native/configs/main.js
line 22 - 38
remove the last ','
plugins.push (
'syntax-class-properties',
'syntax-trailing-function-commas',
'transform-class-properties',
'transform-es2015-block-scoping',
'transform-es2015-computed-properties',
'transform-es2015-destructuring',
'transform-es2015-function-name',
'transform-es2015-literals',
'transform-es2015-parameters',
'transform-es2015-shorthand-properties',
'transform-flow-strip-types',
'transform-react-jsx',
'transform-regenerator',
require('../transforms/transform-regenerator-runtime-insertion'),
['transform-es2015-modules-commonjs', {strict: false, allowTopLevelThis: true}]
);
```
react-native-cli: 2.0.1
react-native: 0.44.0
node 6.11.1
npm 3.10.10
I ran the command for starting the sever by using both commands i.e. npm start and react-native start but it showed me error in failing. please help me to fix this issue
/home/ashu/Downloads/duit-react-native/node_modules/@babel/core/lib/transformation/file/file.js:63
constructor(options, {
^
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] (/home/ashu/Downloads/duit-react-native/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.
at Module._compile (module.js:409:26)
Most helpful comment
Currently it works for me with node v8.
Update node version on macOS.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable