babel / gulp-babel

Gulp plugin for Babel
https://babeljs.io
MIT License
1.32k stars 120 forks source link

Build failing with `[PluginError: @babel/core@^7.0.0 is required]` when version `7.16.0` is in use. #221

Closed the-last-byte closed 2 years ago

the-last-byte commented 3 years ago

https://github.com/babel/gulp-babel/blob/46db7eefad83aee00de102128ba2745b687d3136/index.js#L69-L90

the-last-byte commented 3 years ago

I've just encountered this issue with the following setup:

PS D:\Projects\ProjectName\project> npm -v
8.1.0
PS D:\Projects\ProjectName\project> node -v
v17.0.1
PS D:\Projects\ProjectName\project> npm list
web-marker@0.0.1 D:\Projects\ProjectName\project
+-- @babel/cli@7.16.0
+-- @babel/core@7.16.0
+-- gulp-babel@8.0.0
+-- gulp-concat@2.6.1
+-- gulp@4.0.2
+-- html-minifier@4.0.0
`-- sass@1.43.4

I checked to see whether another package was to blame:

function supportsCallerOption() {
    if (supportsCallerOptionFlag === undefined) {
        try {
            ▶️ console.log(babel.version);
            // Rather than try to match the Babel version, we just see if it throws
            // when passed a 'caller' flag, and use that to decide if it is supported.
            babel.loadPartialConfig({
                caller: undefined,
                babelrc: false,
                configFile: false
            });
            supportsCallerOptionFlag = true;
        } catch (err) {
            supportsCallerOptionFlag = false;
        }
    }

    return supportsCallerOptionFlag;
}

The output was:

PS D:\Projects\ProjectName\project> gulp
[11:35:16] Using gulpfile D:\Projects\ProjectName\project\gulpfile.js
[11:35:16] Starting 'default'...
[11:35:16] Finished 'default' after 2.11 ms
▶️ 7.16.0

node:events:368
      throw er; // Unhandled 'error' event
      ^
[PluginError: @babel/core@^7.0.0 is required] {
  plugin: 'gulp-babel',
  showProperties: true,
  showStack: false,
  __safety: { toString: [Function: bound ] },

Could @babel/core have re-introduced the field or removed the error message?