SyntaxError: Unexpected token import - on gulp component
See original GitHub issueHello,
I’m trying to scaffold a component with a fresh clone, the command is
gulp component --name storage
the error is
[16:18:38] Requiring external module babel-register /var/www/other/boil/gulpfile.babel.js:3 import gulp from ‘gulp’; ^^^^^^
SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:387:25) at loader (/var/www/other/boil/node_modules/babel-register/lib/node.js:158:5) at Object.require.extensions.(anonymous function) as .js at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17) at require (internal/module.js:16:19) at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3) at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:193:16)
Issue Analytics
- State:
- Created 7 years ago
- Comments:23 (1 by maintainers)
Go to babel website, Installation section, and select “Gulp” - http://babeljs.io/docs/setup/#installation
Take a look at step 4 - you will need to create a
.babelrc
configuration file and use a babel-preset. This resolved the issue for me.For me, I just forgot to cp the .babelrc file, with it it’s okay 😉