Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
Error: Failed to load plugin '@babel' declared in '--config

I've seen a few similar questions to this, but I think this issue is a little different.

I have shared ESLint config coming from a dependency, let's call it my-shared-config. The dependency contains a few plugins including @babel like so:

{
  env: { ... },
  plugins: [
    '@babel',
    'import',
    'inclusive-language',
    'react',
    'react-hooks',
  ],
  rules: { ... },
}

The package.json contains these dependencies, among others:

"dependencies": {
  "@babel/core": "7.17.0",
  "@babel/eslint-parser": "7.17.0",
  "@babel/eslint-plugin": "7.16.5",
  "@babel/preset-react": "7.16.7",
  "eslint": "8.8.0",
  "eslint-plugin-import": "2.25.4",
  "eslint-plugin-inclusive-language": "2.2.0",
  "eslint-plugin-react": "7.28.0",
  "eslint-plugin-react-hooks": "4.3.0"
},

For most projects, the shared config works. However, in one project when I run the linter, I get the following error:

Error: Failed to load plugin '@babel' declared in '--config » my-shared-config': Cannot find module '@babel/eslint-plugin'

The only difference with this project to the others - that I can think of - is that it also installs other @babel/ dependencies. My node_modules structure looks like this:

node_modules
  @babel # <-- BABEL
    code-frame
    compat-data
    core
    ...more, but nothing for ESLint
  @my-domain
    my-shared-config
      node_modules
        @babel  # <-- BABEL
          compat-data
          core
          eslint-parser # <-- BABEL ESLINT
          eslint-plugin # <-- BABEL ESLINT
          ...more

When I install @babel/eslint-parser and @babel/eslint-plugin into my project, the linter works fine. Whilst that's ok, it is obviously not a solution I want and I don't want other teams that use my-shared-config to have to do the same. Does anyone know of any other solutions for this problem? I've tried deleting and re-installing my node_modules.

I think this is likely to be an issue with Yarn rather than the Babel dependencies.

UPDATE

This issue only happens when the @babel/core versions are not exactly the same. After bumping the @babel/core version in my-shared-config, the linter throws the same error in other projects until it's own @babel/core version is the same.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda