Closed giobi closed 8 years ago
@giobi the problem is probably your gulp version. Do you use 3.9.1
? -> 3.9.0
is fine!
Works fine for me too! CLI version 3.9.0 Local version 3.9.1
@globl, is problem solved? Closing it for now, feel free to start new discussion.
Hi, thanks for the answers. I cloned again the whole git and the command worked just fine, could have been a library problem but now it's solved :)
for historical reasons I must sayI'm using Debian on a google cloud VM
Just an fyi, still getting this: `[10:09:13] Requiring external module babel-register /Users/guynesher/Work/job-interviews/forecast-xxx-interview/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 (/Users/guynesher/Work/job-interviews/forecast-xxx-interview/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.
uninstalling / reinstalling gulp does not help (did for both local and global copies). It's worth noting I did not clone the repo but copy / pasted it into an existing repo
@gnesher I can see that you're using your global gulp installation. Would you be so kind to do a 'gulp --version' ?
@bastianwegge the problem seems to resolve itself once you clone this repo (vs copying files into an existing repo).
I suspect the problem was that hidden files were not copied.
Gulp was / is version 3.9.1
@gnesher Maybe you didn't read clearly before. Gulp Version 3.9.1 causes this error. That's why cloning the repo works. Gulp is looking in the node_modules folder first, if it can't find the local gulp it resolves to global - which is 3.9.1 => the corrupt version. Just install 3.9.0 globally OR locally then you're fine.
@bastianwegge heh, I'm just going to apologies and walk away :)
➜ ng6-experiment git:(master) gulp -v
[21:54:38] Failed to load external module babel-core/register
[21:54:38] Failed to load external module babel/register
[21:54:38] CLI version 3.9.0
[21:54:38] Local version 3.9.0
➜ ng6-experiment git:(master) gulp
[21:54:41] Failed to load external module babel-core/register
[21:54:41] Failed to load external module babel/register
/Users/monsterstep/dev/ng6-experiment/gulpfile.babel.js:3
import gulp from 'gulp';
^^^^^^
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
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 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:192:16)
at module.exports (/usr/local/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:17:3)
➜ ng6-experiment git:(master)
@crapthings your node Version? node --version
and just btw: Why does your gulp -v
show errors? xD
Did you do an npm install
?
@bastianwegge i've done npm install and install gulp global by npm i -g gulp@3.9.0
node v4.4.7 npm 2.15.8
Does your gulp -v
show errors all the time?
Did you execute gulp -v
from within the folder the project is in?
Otherwise give me some data to work with, what operating system are you on? Did you try deleting and then cloning again?
Same here:
[21:48:17] Requiring external module babel-core/register
[21:48:17] CLI version 3.9.0
[21:48:17] Local version 3.9.0
@crapthings I get this message too if I don't typed npm install before.
[21:54:38] Failed to load external module babel/register
node -v
v4.4.7
Does your gulp -v show errors all the time?
No just in this project
Did you try deleting and then cloning again?
Did you execute gulp -v from within the folder the project is in?
Yes
Fresh clone
Saw also a similiar thread but didn't help https://github.com/yeoman/generator-webapp/issues/356
Regards
same for me , on OSX 10.9.5 , node v4.5.0, npm 2.15.9 :
gulp -v returns : Failed to load external module babel/register CLI version 3.9.0 Local version 3.9.0
Does your gulp -v show errors all the time? Just in this project
Did you try deleting and then cloning again? Yes
Did you execute gulp -v from within the folder the project is in? Yes
Ok after clearing my npm cache , uninstalling both global and local version of gulp and gulp-cli + opening a new window terminal and reinstalling everything , it worked for me with gulp v3.9.1
Same problem here. I had installed 3.9.1 freshly - never installed before on this computer. Saw this issue, uninstalled, and reinstalled 3.9.0. The error looks different now, but amounts to the same problem I suspect:
Gulpfile.js:1
(function (exports, require, module, __filename, __dirname) { import gulp from "gulp";
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (C:\Users\username\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
at Liftoff.<anonymous> (C:\Users\username\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:198:16)
The (function (exports, require, module, __filename, __dirname) {
bit that's not in my Gulpfile.js. Apparently Gulp is making things up.
I'll go back to old-fashioned ES5-style requires then. For now.
Node 6.2.0 NPM 3.8.9
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.
I have the same issue with gulp version 3.9.1. Same error with version 3.9.0. Error: (function (exports, require, module, filename, dirname) { ��v ^ SyntaxError: Invalid or unexpected token at createScript (vm.js:53:10) at Object.runInThisContext (vm.js:95:10) at Module._compile (module.js:543:28) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Liftoff.handleArguments (C:\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
Details: gulp -v [20:41:44] CLI version 3.9.0 [20:41:44] Local version 3.9.0
OS: windows 10
For me, I just forgot to cp the .babelrc file, with it it's okay ;)
"es2015" preset in .babelrc worked in my case. CLI version 2.0.1 Local version 4.0.0
How may I correct this position? $ gulp [21:44:57] Working directory changed to ~ C:\Users\Steven\gulpfile.js:1 (function (exports, require, module, filename, dirname) { <!DOCTYPE html> ^
SyntaxError: Unexpected token < at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at execute (C:\Users\Steven\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\index.js:36:18)
I am new to gulp.
this was the initial gulpfile.js
content
var gulp = require('gulp');
gulp.task('default', defaultTask);
function defaultTask(done) { // place code for your default task here done(); }
Hey @Teatoller - did you manage to fix your gulp issue? Was having the same issue just no eand fixed it as below:
npm rm --global gulp
If it doesn't work use sudo npm rm --global gulp
npm install --global gulp-cli
gulpfile.js
to gulpfile.babel.js
.Everything is as per the documentation: https://github.com/gulpjs/gulp/blob/4.0/docs/getting-started.md.
Hope that would be helpful.
Hello,
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. (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:193:16)