react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Babel/Strict error - 2048 Example

Open AlexHandy1 opened this issue 11 years ago • 19 comments

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.

AlexHandy1 avatar Oct 05 '15 20:10 AlexHandy1

Same issue here!

TowkayNew avatar Oct 06 '15 04:10 TowkayNew

What version of Node are you using? (Make sure it's at least 4.)

ide avatar Oct 06 '15 04:10 ide

Fixed after updating Node to the latest version! Thank you @ide ! :smile:

TowkayNew avatar Oct 06 '15 04:10 TowkayNew

@TowkayNew are you ok to close

mikearmstrong001 avatar Oct 06 '15 05:10 mikearmstrong001

This issue is opened by @AlexHandy1 , think we will wait for him to reply before we close this issue! Cheers!

TowkayNew avatar Oct 06 '15 06:10 TowkayNew

@TowkayNew @mikearmstrong001 - worked for me too, thanks for responding so quickly!

AlexHandy1 avatar Oct 06 '15 08:10 AlexHandy1

and @ide, thanks

AlexHandy1 avatar Oct 06 '15 08:10 AlexHandy1

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.

YoungElPaso avatar Oct 13 '15 18:10 YoungElPaso

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. (/Users/me/git/multiply/Multiply/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) . . . See http://facebook.github.io/react-native/docs/troubleshooting.html for common problems and solutions. fs.js:500 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: EMFILE, too many open files '/Users/me/.babel.json' at Error (native) at Object.fs.openSync (fs.js:500:18) at Object.fs.writeFileSync (fs.js:1099:15) at process.save (/Users/me/git/multiply/Multiply/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19) at process.emit (events.js:107:17) at process.exit (node.js:600:17) at process. (/Users/me/git/multiply/Multiply/node_modules/react-native/packager/packager.js:149:11) at process.emit (events.js:107:17) at process._fatalException (node.js:236:26) at Walker. (/Users/me/git/multiply/Multiply/node_modules/react-native/node_modules/sane/src/node_watcher.js:351:12) Process terminated. Press to close the window

clocksmith avatar Oct 15 '15 17:10 clocksmith

@clocksmith Node 0.12.7 is not supported. Please upgrade to Node 4.

ide avatar Oct 15 '15 21:10 ide

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.

..........

sriraman avatar Oct 20 '15 14:10 sriraman

Same error here with node 5.0.0 on osx 10.11.1 El Capitan. Any news?

JonathanWi avatar Nov 01 '15 13:11 JonathanWi

+1

gabriellupu avatar Nov 06 '15 16:11 gabriellupu

Seeing similar issue with node v4.1.2.

donmullen avatar Nov 06 '15 20:11 donmullen

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

shioju avatar Nov 11 '15 05:11 shioju

That fixed my issue ^

Robdel12 avatar Nov 15 '15 21:11 Robdel12

"nvm alias default 5" solved my issue. Thanks.

imoreapps avatar Nov 17 '15 01:11 imoreapps

yup - defaulting to 4 or higher makes things :+1:

deanrad avatar Nov 19 '15 02:11 deanrad

@shioju that fixed my issue as well

GerryFudd avatar Jan 21 '16 18:01 GerryFudd