foundation-sites: ZURB/template fails to load Babel
What should happen?
Upon runnig Gulp the dist folder should be build properly. …
What happens instead?
After a clean install , running yarn install and running gulp
The terminal gives:
[09:31:15] Failed to load external module babel-register
[09:31:15] Failed to load external module babel-core/register
[09:31:15] Failed to load external module babel/register
/Users/rdg/Documents/REPOSITORY/xxx/gulpfile.babel.js:3
import plugins from 'gulp-load-plugins';
^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:80:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:316:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
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)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
…
Possible Solution
Test Case and/or Steps to Reproduce (for bugs)
How to reproduce:
- clone a fresh repo Master,
- run
yarn install - and then
gulp
Context
…
Your Environment
- Foundation version(s) used: https://github.com/zurb/foundation-zurb-template
- Browser(s) name and version(s): NA
- Device, Operating System and version: OSX High Sierra
- Link to your project: NA
Checklist
- I have read and follow the CONTRIBUTING.md document.
- There are no other issues similar to this one.
- The issue title and template are correctly filled.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (18 by maintainers)
Was having the same issue an it cost me hours, but found the solution that worked for me. Add a file in the same directory as the gulpfile.babel.js, called:
.babelrcThen add:
{ "presets": [ "@babel/preset-env" ] }Inside it. Run: yarn start or gulp And it should work again.
Sorry Jeremy, I should delete my comment, but I’ll reply first. I spent a few hours last night starting with the Zurb Foundation for Emails installation tutorial, then various forums looking for solutions.
Failed to load external module @babel/register was a common error amongst others. I was starting to feel like I was going round in circles. I am not familiar enough to understand what the problem really is.
I got here via search, but this seems to be an obvious notification when running the script, where the script itself, does not brake. But I just started a new foundation-sites project and I can get it to work. When running
foundation-watchorgulpI getI tried the solutions in this thread. But these solutions did not help me.
hi i deleted everything in /usr/local/lib/node-modules and now it works.
In general this should just be a warning and it is a known problem of the babel-loader.