Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Failed to load external module babel-register #1105

Closed
kepes opened this issue Oct 6, 2017 · 10 comments
Closed

Failed to load external module babel-register #1105

kepes opened this issue Oct 6, 2017 · 10 comments

Comments

@kepes
Copy link

kepes commented Oct 6, 2017

How can this bug be reproduced?

  1. Install dev system from docker "wordpress:4.8-php7.0-apache". This is a Debian Jessie
  2. Install node and npm
  3. npm install and npm start as des

What did you expect to happen?
FoundationPress starts

What happened instead?

root@ea2fc8081991:/var/www/html/wp-content/themes/FoundationPress# npm start

> foundationpress@2.10.3 start /var/www/html/wp-content/themes/FoundationPress
> gulp

[09:00:45] Failed to load external module babel-register
[09:00:45] Failed to load external module babel-core/register
[09:00:45] Failed to load external module babel/register
/var/www/html/wp-content/themes/FoundationPress/gulpfile.babel.js:3
import plugins       from 'gulp-load-plugins';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at execute (/var/www/html/wp-content/themes/FoundationPress/node_modules/gulp-cli/lib/versioned/^4.0.0-alpha.2/index.js:37:18)

npm ERR! Linux 4.4.66-boot2docker
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! foundationpress@2.10.3 start: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foundationpress@2.10.3 start script 'gulp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the foundationpress package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs foundationpress
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls foundationpress
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     `/var/www/html/wp-content/themes/FoundationPress/npm-debug.log

Please List the Following:

@colin-marshall
Copy link
Collaborator

@kepes please do the following:

  • run rm -rf node_modules
  • run npm cache clean
  • run npm install
  • provide us with all output from npm install

@rescriba01
Copy link

Thanks @colin-marshall that worked for me like a charm!

@colin-marshall
Copy link
Collaborator

@rescriba01 you're welcome. Those directions actually weren't supposed to solve a problem, but if they solved yours that's great!

@adambundy
Copy link

adambundy commented Dec 7, 2017

Im getting a similar babel/register error on running 'npm start' on a local dev instance, but everything seems to be working ok. Should I run the same steps you posted @colin-marshall?

[09:26:21] Failed to load external module @babel/register [09:26:21] Requiring external module babel-register

@colin-marshall
Copy link
Collaborator

@adambundy this has confused a lot of people because it's not really an error. Gulp tries one thing, it fails, and then it uses a fallback. As long as the fallback works (which in your case it does) there is nothing to worry about. See here:
gulpjs/gulp#1631

@colin-marshall
Copy link
Collaborator

@kepes is this still an issue?

@adambundy
Copy link

Thanks @colin-marshall!

@askdesigners
Copy link

I get that this is meant to be a warning, but then it also derails the script itself with the error

TypeError: require.extensions.hasOwnProperty is not a function
    at requireDir (/project/node_modules/gulp-git/node_modules/require-dir/index.js:93:37)
    at Object.<anonymous> (/project/node_modules/gulp-git/index.js:4:18)
    at Module._compile (module.js:635:30)
    at Module._extensions..js (module.js:646:10)
    at Object.require.extensions.(anonymous function) [as .js] (/project/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)

Are these related errors?

@tillydray
Copy link

I'm having the same error as @askdesigners.

$ gulp d
[10:53:51] Failed to load external module @babel/register
[10:53:51] Requiring external module babel-register
/<REDACTED>/node_modules/gulp-git/node_modules/require-dir/index.js:93
            if (!require.extensions.hasOwnProperty(ext)) {
                                    ^

TypeError: require.extensions.hasOwnProperty is not a function
    at requireDir (/<REDACTED>/node_modules/gulp-git/node_modules/require-dir/index.js:93:37)
    at Object.<anonymous> (/<REDACTED>/node_modules/gulp-git/index.js:4:18)
    at Module._compile (module.js:653:30)
    at Module._extensions..js (module.js:664:10)
    at Object.require.extensions.(anonymous function) [as .js] (/<REDACTED>/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)

@cruelmelody
Copy link

Going to chime in on this as well. I'm getting the exact same errors as the above two users:

tzr90lshth:<my-site> <redacted>$ gulp watch
[15:41:39] Failed to load external module @babel/register
[15:41:39] Requiring external module babel-register
fs.js:25
'use strict';
^

ReferenceError: internalBinding is not defined
    at fs.js:25:1
    at req_ (/Users/<redacted>/Sites/devdesktop/<my-site>/node_modules/natives/index.js:140:5)
    at Object.req [as require] (/Users/<redacted>/Sites/devdesktop/<my-site>/node_modules/natives/index.js:54:10)
    at Object.<anonymous> (/Users/<redacted>/Sites/devdesktop/<my-site>/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/<redacted>/Sites/devdesktop/<my-site>/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
    at Function.Module._load (internal/modules/cjs/loader.js:536:3)

Has anybody experienced anything similar, or encountered a fix for this? Adding the @babel/register to my package.json file doesn't seem to work after installing it.

Running node JS v11.0.0 and npm v6.4.1.

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

No branches or pull requests

8 participants