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-core/register #878

Closed
cesards opened this issue Jul 9, 2016 · 10 comments
Closed

Requiring external module babel-core/register #878

cesards opened this issue Jul 9, 2016 · 10 comments

Comments

@cesards
Copy link

cesards commented Jul 9, 2016

I have read all the closed issues related, but there is no way to fix the problem:

Once I download the web-starter-kit and I run npm install, and then I try to serve the repo running gulp serve but I get:

/Users/cdi08/workspace-github/SiteCesards/gulpfile.babel.js:27
import path from 'path';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at loader (/Users/cdi08/workspace-github/SiteCesards/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/cdi08/workspace-github/SiteCesards/node_modules/babel-register/lib/node.js:168:7)
    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 (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)

Running gulp -v I get the following:

[10:35:50] Requiring external module babel-core/register
[10:35:50] CLI version 3.9.0
[10:35:50] Local version 3.9.1

Then I've tried many things, as

sudo npm install babel-register
sudo npm install babel-core

and also trying to downgrade the gulp version:

npm install -g [email protected]

I get nothing.

Last I tried was

npm install --save-dev babel-register

but I get the following error:

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save-dev" "babel-register."
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/babel-register.
npm ERR! 404
npm ERR! 404  'babel-register.' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Any thoughts? Thank you!

@thecreation
Copy link

thecreation commented Jul 11, 2016

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.

@mikeritter
Copy link

same issue on win 10

@ghost
Copy link

ghost commented Jul 29, 2016

@cesards I had the same issue and solved it after adding the missing .babelrc file with the following content:

{
  "presets": ["es2015"],
  "retainLines": true
}

@GavinSong123
Copy link

same issue on ubuntu 16.04 and aftering adding content to .babelrc, it has not been solved.

@mikeritter
Copy link

I went back and reviewed the installation instructions in the README file. I had skipped a step there. Be sure to go back and do that.

@cesards
Copy link
Author

cesards commented Aug 8, 2016

Thanks @luc-baro . It works!! It's just adding the .babelrc file to the root of the folder.

@lisawilkins
Copy link

I've run through all the open and closed issues pertaining to this, tried all of the various fixes, uninstalls, installs, code changes, running older versions of gulp, repo tossing & reinstalling and am still getting ...

Requiring external module babel-core/register

@mpavel
Copy link

mpavel commented Apr 14, 2017

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.

@jaenlasan
Copy link

I just solved the problem by changing the name of the file .babelrc to .babelrc.json. I hope this help you out

@Stevemoretz
Copy link

Stevemoretz commented Apr 28, 2021

@cesards I had the same issue and solved it after adding the missing .babelrc file with the following content:

{
  "presets": ["es2015"],
  "retainLines": true
}

The second line made my setup pretty fast thank you!

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

8 participants