Babel/Strict error - 2048 Example
Cloned repo, successfully npm installed, go to run example from opening Xcode (have run other app set-ups fine included Movies tutorial) and get below error.
Also fails on same error when run npm start
Tried brew update and commenting out 'strict mode' but no luck.
Running on a MacBook Pro Yosemite (10.10.5)
/Users/alexanderhandy/Documents/react-native/packager/transformer.js:13
const babel = require('babel-core');
^^^^^
SyntaxError: Use of const in strict mode.
Same issue here!
What version of Node are you using? (Make sure it's at least 4.)
Fixed after updating Node to the latest version! Thank you @ide ! :smile:
@TowkayNew are you ok to close
This issue is opened by @AlexHandy1 , think we will wait for him to reply before we close this issue! Cheers!
@TowkayNew @mikearmstrong001 - worked for me too, thanks for responding so quickly!
and @ide, thanks
Just an FYI, for Linux, I had to update nodejs via nvm to 4.1.1, although my normal version of nodejs (installed via official package) was 4.1.2
Something to note as I guess react is using the nvm version.
I am getting the same issue on OSX Yosemite 10.10.5 . I have updated node:
$ node -v v0.12.7
Partial stack trace:
/Users/me/git/multiply/Multiply/node_modules/react-native/packager/transformer.js:13
const babel = require('babel-core');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
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 process.
@clocksmith Node 0.12.7 is not supported. Please upgrade to Node 4.
I'm also getting the same error in Yosemite 10.10.5 after updating it to 4.x also.
$ node -v
v4.2.1
Stack Trace :
..........
node_modules/react-native/packager/transformer.js:13
const babel = require('babel-core');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
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 process.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/witworks/react-native/myFirstHelloWorld/node_modules/react-native/node_modules/worker-farm/lib/child/index.js:45:34)
at process.emit (events.js:110:17)
at handleMessage (child_process.js:324:10)
React packager ready.
/Applications/XAMPP/xamppfiles/htdocs/witworks/react-native/myFirstHelloWorld/node_modules/react-native/packager/transformer.js:13
const babel = require('babel-core');
^^^^^
SyntaxError: Use of const in strict mode.
..........
Same error here with node 5.0.0 on osx 10.11.1 El Capitan. Any news?
+1
Seeing similar issue with node v4.1.2.
if you are using nvm, make sure the default node version is 4 or above. That's the version that xcode will use, no matter what your current node version is.
Just run nvm alias default 4 to set the default to v4.x.x
That fixed my issue ^
"nvm alias default 5" solved my issue. Thanks.
yup - defaulting to 4 or higher makes things :+1:
@shioju that fixed my issue as well