Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load external module @babel/register while gulp

In my react project everything works fine on my vmware. But when I cloned the same app and ran gulp command I am getting this error during compilation saying

   MacBook-Pro:Frontend1.0 apurvgandhwani$ gulp
[18:42:31] Failed to load external module @babel/register
[18:42:31] Requiring external module babel-register
[18:42:32] Using gulpfile ~/Frontend1.0/gulpfile.babel.js
[18:42:32] Starting 'build:watch'...
[18:42:32] Starting 'copy:assets'...
[18:42:32] Starting 'copy:vendors'...
  Cleaned build/ 
  Copied 12 asset entries.
[18:42:32] Finished 'copy:vendors' after 329 ms
[18:42:32] Starting 'copy:views'...
[18:42:32] copied views all files 19.75 kB
[18:42:32] Finished 'copy:views' after 77 ms
[18:42:32] Starting 'copy:public'...
[18:42:33] Finished 'copy:public' after 132 ms
[18:42:33] Finished 'copy:assets' after 540 ms
[18:42:33] Starting 'bundle:dll'...
DLL Bundled.
Hash: 45f26d608c690be6e6c5
Version: webpack 1.15.0
Time: 2181ms
        Asset     Size  Chunks             Chunk Names
dll.vendor.js  3.11 MB       0  [emitted]  vendor
[18:42:35] Finished 'bundle:dll' after 2.21 s
[18:42:35] Starting 'bundle'...
Hash: 7457a3cd38cf5c991640
Version: webpack 1.15.0
Time: 508ms
           Asset     Size  Chunks             Chunk Names
server-bundle.js  37.3 kB       0  [emitted]  main
  -- server:watch bundled.
Hash: e4a95c52aac91b47f75c
Version: webpack 1.15.0
Time: 46339ms
         Asset     Size  Chunks             Chunk Names
main-bundle.js  20.1 MB       0  [emitted]  main
  -- client bundled.
[18:43:21] Finished 'bundle' after 46 s
[18:43:21] Starting 'start:server'...
Starting Node Server...
[18:43:21] Finished 'start:server' after 68 ms
[18:43:21] Starting 'watch:sync'...
[18:43:21] [nodemon] 1.11.0
[18:43:21] [nodemon] to restart at any time, enter `rs`
[18:43:21] [nodemon] watching: build/server-bundle.js
[18:43:21] [nodemon] starting `node --debug build/server-bundle.js`
Server Restarted: Reloading BrowserSync.
(node:6700) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
[18:43:21] [nodemon] app crashed - waiting for file changes before starting...
[tessact: ] Proxying: http://localhost:4200
[tessact: ] Access URLs:
 -------------------------------------
       Local: http://localhost:3001
    External: http://192.168.0.32:3001
 -------------------------------------
          UI: http://localhost:3002
 UI External: http://192.168.0.32:3002
 -------------------------------------
[tessact: ] Watching files...
[18:43:21] Finished 'watch:sync' after 262 ms
[18:43:21] Starting 'watch:assets'...
[18:43:22] Finished 'watch:assets' after 110 ms
[18:43:22] Finished 'build:watch' after 50 s
[18:43:22] Starting 'default'...
[18:43:22] Finished 'default' after 37 μs
webpack built e4a95c52aac91b47f75c in 26323ms
Hash: e4a95c52aac91b47f75c
Version: webpack 1.15.0
Time: 26323ms
         Asset     Size  Chunks       Chunk Names
main-bundle.js  20.1 MB       0       main
webpack: Compiled successfully.
[18:50:28] [nodemon] restarting due to changes...
[18:50:28] [nodemon] starting `node --debug build/server-bundle.js`
Server Restarted: Reloading BrowserSync.
[tessact: ] Reloading Browsers...
(node:6705) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
[18:50:28] [nodemon] app crashed - waiting for file changes before starting...
Abort trap: 6

This is my package.json snippet

 "dependencies": {
    "@trendmicro/react-toggle-switch": "^0.5.5",
    "animate.css": "^3.5.1",
    "axis": "^0.6.1",
    "babel-core": "^6.10.4",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-react": "^6.11.1",
    "babel-preset-react-hmre": "^1.1.1",

I have followed a lot of threads but nothing seems to solve my case. What should I do to solve this? I already have babel-core instead of babel in my package.json which most of the solutions suggest.

like image 275
EdG Avatar asked Feb 01 '18 17:02

EdG


2 Answers

I have solved it by downgrading the gulp version from 3.9.1 to 3.9.0. Looks like 3.9.1 is buggy.

like image 189
EdG Avatar answered Nov 12 '22 01:11

EdG


This is just a warning that Gulp failed to load @babel/register but on the next line it successfully loaded the fallback module: babel-register

https://github.com/gulpjs/gulp/issues/1631

You could install the babel-core/register module to remove the warning, but it's not necessary.

like image 28
Toma Nistor Avatar answered Nov 12 '22 00:11

Toma Nistor