Can't run foundation build/watch on a fresh installation


I wanted to try Foundation for Emails, but got stuck at the very beginning. After installing foundation build/watch exits with the following error:

$ foundation build

> foundation-emails-template@1.0.0 build /var/www/html/templates/email
> gulp --production

[21:27:37] Requiring external module @babel/register
    throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);

Error: Plugin/Preset files are not allowed to export objects, only functions. In /var/www/html/templates/email/node_modules/babel-preset-es2015/lib/index.js
    at createDescriptor (/var/www/html/templates/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
    at (/var/www/html/templates/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at (<anonymous>)
    at createDescriptors (/var/www/html/templates/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/var/www/html/templates/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at presets (/var/www/html/templates/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
    at mergeChainOpts (/var/www/html/templates/node_modules/@babel/core/lib/config/config-chain.js:315:26)
    at /var/www/html/templates/node_modules/@babel/core/lib/config/config-chain.js:278:7
    at buildRootChain (/var/www/html/templates/node_modules/@babel/core/lib/config/config-chain.js:118:22)
    at loadPrivatePartialConfig (/var/www/html/templates/node_modules/@babel/core/lib/config/partial.js:85:55)
Error: foundation-emails-template@1.0.0 build: `gulp --production`
Exit status 1
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/lifecycle.js:217:16)
    at emitTwo (events.js:126:13)
    at EventEmitter.emit (events.js:214:7)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/foundation-cli/node_modules/npm/lib/utils/spawn.js:24:14)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

It seems you have a different setup than it is defined in package.json.
This seems to come from the babel-loader.

Please provide the exact steps to reproduce this.


I think it’s easiest, to provide the console output:

Basically I just ran $ foundation new --framework emails. After that $foundation watch and since it exits with

Requiring external module @babel/register
          throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(pkgConfig.filepath)}#babel\n` + ` - ${_path().default.basename(config.filepath)}\n` + `from ${loc}`);

I deleted .babelrc which led to the error above.


  • Xubuntu 18.04
  • $ node -v
    • v8.16.2
  • $ foundation -v
    • Foundation CLI version 2.2.5`

Please don’t delete this as this is needed for the babel transpiler to load the correct setup. It looks like you have another config file somewhere. Probably some levels above.

I will test if I can reproduce this later today.

Can you try to delete the entry from the package.json file?

I think it is an issue with the old es2015 preset and a new babel version.


I will check this.

I can not reproduce this using Node 10.16.3.
So it seems you have some babel configuration some levels up.
Please double check your paths for any babel configuration files.

1 Like


it doesn’t matter if I delete .babelrc or the lines

" babel": {
    "presets": [

in package.json (and keep .babelrc. The error stays the same.

No, I don’t:

/var/www/html/templates/email$ ls -al | grep babel
-rw-rw-r--  1 tobias tobias   28 Apr 21 23:06 .babelrc
-rw-rw-r--  1 tobias tobias 6767 Apr 21 23:06 gulpfile.babel.js
/var/www/html/templates/email$ cd ..
/var/www/html/templates$ ls -al | grep babel
/var/www/html/templates$ cd ..
/var/www/html$ ls -al | grep babel
/var/www/html$ cd ..
/var/www$ ls -al | grep babel
/var/www$ cd ..
/var$ ls -al | grep babel
/var$ cd ..
/$ ls -al | grep babel

This let me double check it in a completely other directory (home dir). There it works.
I found that a parent dir had a node_modules folder with babel within. Probably that was the problem.

Yes, babel-register and the loader looks for configs and different versions also some levels upwards so this should be the cause.

1 Like

All in all, not a problem caused by us but by babel and how it looks for available versions and configs.

1 Like

Thanks for the excellent support!