Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring external module babel-register #875

Closed
dadatawajue opened this issue Jun 18, 2016 · 7 comments
Closed

Requiring external module babel-register #875

dadatawajue opened this issue Jun 18, 2016 · 7 comments

Comments

@dadatawajue
Copy link

dadatawajue commented Jun 18, 2016

I realize this issue has been reported and closed before #726 and 862 but none of the solutions in listed there has worked for me

The error:

$ gulp serve
Requiring external module babel-register
/dadada/gulpfile.babel.js:27
import path from 'path';
^^^^^^

SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at loader (/dadada/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/dadada/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354: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:193:16)

Some info about my setup (running Ubuntu 16.04 LTS with Web Starter Kit 0.6.3):

$ gulp -v
[04:58:14] Requiring external module babel-register
[04:58:14] CLI version 3.9.1
[04:58:14] Local version 3.9.1

$ node -v
v4.2.6

$ npm ls --depth=0
/dadada
├── apache-server-configs@2.14.0
├── babel@6.5.2
├── babel-core@6.9.1
├── babel-preset-es2015@6.9.0
├── babel-register@6.9.0
├── browser-sync@2.13.0
├── del@2.2.0
├── eslint-config-google@0.3.0
├── gulp@3.9.1
├── gulp-autoprefixer@3.1.0
├── gulp-babel@6.1.2
├── gulp-cache@0.2.2
├── gulp-concat@2.6.0
├── gulp-cssnano@2.1.2
├── gulp-eslint@1.1.1
├── gulp-htmlmin@1.3.0
├── gulp-if@2.0.1
├── gulp-imagemin@2.4.0
├── gulp-load-plugins@1.2.4
├── gulp-newer@1.2.0
├── gulp-sass@2.3.2
├── gulp-size@2.1.0
├── gulp-sourcemaps@1.6.0
├── gulp-uglify@1.5.3
├── gulp-uncss@1.0.5
├── gulp-useref@3.1.0
├── psi@2.0.4
├── run-sequence@1.2.1
├── sw-precache@3.2.0
└── sw-toolbox@3.2.1

I've tried to reinstall gulp, tried $ npm cache clean && npm install, tried downgrading gulp to 3.9.0

@dadatawajue
Copy link
Author

I just tried with the master branch, which works but get some error (and I assume it would be better to use v0.6.3):

$ gulp serve
[05:38:28] Requiring external module babel-register
[05:38:38] Using gulpfile ~/Downloads/web-starter-kit-master/gulpfile.babel.js
[05:38:38] Starting 'scripts'...
[05:38:39] Starting 'styles'...
[05:38:43] scripts all files 1.32 kB
[05:38:43] Finished 'scripts' after 5.27 s
[05:38:46] styles all files 3 kB
[05:38:46] Finished 'styles' after 7.61 s
[05:38:46] Starting 'serve'...
[05:38:47] 'serve' errored after 149 ms
[05:38:47] Error: watch /dadada/Downloads/web-starter-kit-master/app/ ENOSPC
    at exports._errnoException (util.js:870:11)
    at FSWatcher.start (fs.js:1234:19)
    at Object.fs.watch (fs.js:1262:11)
    at Gaze._watchDir (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:289:30)
    at /dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:358:10
    at iterate (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/helper.js:52:5)
    at Object.forEachSeries (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/helper.js:66:3)
    at Gaze._initWatched (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:354:10)
    at Gaze.add (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:177:8)
    at new Gaze (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:74:10)
    at gaze (/dadada/Downloads/web-starter-kit-master/node_modules/gaze/lib/gaze.js:86:10)
    at Object.module.exports [as watch] (/dadada/Downloads/web-starter-kit-master/node_modules/glob-watcher/index.js:12:17)
    at Gulp.watch (/dadada/Downloads/web-starter-kit-master/node_modules/gulp/index.js:40:14)
    at Gulp.<anonymous> (gulpfile.babel.js:180:8)
    at module.exports (/dadada/Downloads/web-starter-kit-master/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/dadada/Downloads/web-starter-kit-master/node_modules/orchestrator/index.js:273:3)
[WSK] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.0.111:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.0.111:3001
 --------------------------------------
[WSK] Serving files from: .tmp
[WSK] Serving files from: app

@cesards
Copy link

cesards commented Jul 9, 2016

@dadatawajue I have the same problem. What steps did you follow to download that branch from the repo? I didn't see anyone pointing to that version :-/

Thanks!

Issue linked:
#878

@thecreation
Copy link

I am using ubuntu 14.04. And i am using nvm managing the nodejs.

Runing gulp -v getting the error below

[20:54:47] Failed to load external module babel/register
[20:54:47] CLI version 3.9.0
[20:54:47] Local version 3.9.1

And the issue was solved by the steps below:

sudo rm -r /usr/lib/node_modules/
sudo rm /usr/bin/gulp
npm cache clear
npm uninstall gulp-cli -g
npm uninstall gulp -g
npm install gulp-cli -g

Hope it will be helped for whom that using nvm.

@herodrigues
Copy link

herodrigues commented Jan 1, 2017

@amazingSurge the command sudo rm -r /usr/lib/node_modules/ will exclude npm if you have installed it via package manager with nodejs.

@quangthien27
Copy link

Adding .babelrc file may help

{
  "presets": [
    "es2015"
  ]
}

@AndrewSavetchuk
Copy link

@quangthien27 Thanks, it's working for me!

Adding .babelrc file may help

@cuonghuynh
Copy link

@quangthien27 Thanks, another way that you can add to package.json
"babel": {
"presets": [
"es2015"
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants