ahmadawais / WPGulp

An advanced Gulp workflow for WordPress development with extensive documentation. Used by 40,000+ themes and plugins.

Home Page:https://twitter.com/MrAhmadAwais/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Requiring external module @babel/register

fsdevriver opened this issue · comments

I follow your instruction, but unfortunately i got an errror says

Requiring external module @babel/register

I use laragon for dev server

FYI this is normal, in order to compile from ES6 syntax to JS.
You have the same problem as me and I didn't find the time to fix it yet and it can take up to a few minutes to register on my machine depending on project!! Crazy as some guys have it loaded in just 2 seconds. Edit: I now have new imac with 40Gb of ram and it now takes 2 seconds.

I have a similar issue. Here is the console message

Requiring external module @babel/register
/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_modules/@babel/core/lib
/config/config-descriptors.js:178
throw new Error(Plugin/Preset files are not allowed to export objects, only functions. In ${file path});
^

Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/edelsteinm/Lo
cal Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_modules/babel-preset-es2015/lib/index.js
at createDescriptor (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/nod

e_modules/@babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_modul
es/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map ()
at createDescriptors (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/no
de_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/c
moa/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at presets (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_modules
/@babel/core/lib/config/config-descriptors.js:47:19)
at mergeChainOpts (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_

modules/@babel/core/lib/config/config-chain.js:320:26)
at /Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_modules/@babel/c
ore/lib/config/config-chain.js:283:7
at buildRootChain (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/cmoa/node_
modules/@babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig (/Users/edelsteinm/Local Sites/cmoa2019/app/public/wp-content/themes/
cmoa/node_modules/@babel/core/lib/config/partial.js:85:55)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! your-project@1.0.0 start: gulp
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the your-project@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/edelsteinm/.npm/_logs/2019-10-18T15_13_42_678Z-debug.log

Please see the debug.log file attached.
2019-10-18T15_06_00_223Z-debug.log

I installed @babel/register (alongside the older babel-register package that is being used by WPGulp), and everything seems to work fine.

@hhasan16 & @max-cmoa: Could you provide a link to a WP theme plus corresponding package.json and wpgulp.config.js files, please?

It seems I can reproduce this bug. What versions of node and npm are you using?

This was a long time ago. I forgot about this. I am not running into this issue anymore. For you information I am using:
node v10.21.0
npm 6.14.4

I can't link to the theme I am using, because it is proprietary. My apologies for this.

hello,
i'm testing the wpgulp workflow and i have the babel/register requiring bug. I'm using the last node and npm version.
tried to re install @babel/register but it still doesn't work

any new idea ?

thanks !!! ( great job )

@mat-cat Did you try to delete your node_modules directory and reinstall them?

Yop,
I did but same error

Hi @mat-cat! Maybe using nvm and trying node v10 instead of v12 or v14 helps. When I run e.g. npm run translate I get the message that @babel/register is required (which is newer), while babel-register (the older package) is used when just running gulp translate (or any other task). You could also try to globally upgrade gulp, but I am not sure if this will work, as the deprecated gulp-util and other outdated packages are needed for certain WPGulp tasks. Hope this helps!