Babel:检测到重复的插件/预设错误

自在

我正在前端主机上进行React课程,我们不得不修改babel的配置,以允许状态实例化,例如:state = {index: 0}在类组件中,但是在运行命令时:,并在根目录中创建文件,并进行如下修改:我收到以下错误:
npm install -D babel-eslint @babel/core @babel/preset-env @babel/plugin-proposal-class-properties @babel/preset-react
.babelrc
{ "presets": ["@babel/preset-react", "@babel/preset-env"], "plugins": ["@babel/plugin-proposal-class-properties"] }

/home/rahat/Documents/react_adopt_me/src/App.js: Duplicate plugin/preset detected.
    If you'd like to use two separate instances of a plugin,
    they need separate names, e.g.
    
      plugins: [
        ['some-plugin', {}],
        ['some-plugin', {}, 'some unique name'],
      ]
    
    Duplicates detected are:
    [
      {
        "alias": "/home/rahat/Documents/react_adopt_me/src/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
        "dirname": "/home/rahat/Documents/react_adopt_me/src",
        "ownPass": false,
        "file": {
          "request": "@babel/plugin-proposal-class-properties",
          "resolved": "/home/rahat/Documents/react_adopt_me/src/node_modules/@babel/plugin-proposal-class-properties/lib/index.js"
        }
      },
      {
        "alias": "base$2",
        "options": {
          "loose": "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"
        },
        "dirname": "/home/rahat/Documents/react_adopt_me/src",
        "ownPass": false
      }
    ]
杰科西格

我相信这可能是节点版本问题。

如果您想快速修复,请通过以下方式卸载plugin-proposal-class-properties:

npm卸载@ babel / plugin-proposal-class-properties

然后禁用/删除.babelrc中的插件:

{
    "presets": ["@babel/preset-react", "@babel/preset-env"]
    //"plugins": ["@babel/plugin-proposal-class-properties"]
}

清除缓存:

npm运行clear-build-cache

然后再次运行服务器。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

检测到重复条目时显示错误消息

重复Notif检查触发错误508(检测到循环)

使用预设时,是否可以在babel中禁用插件?

Eclipse TFS插件未检测到更改

Jenkins Mercurial 插件未检测到更改

错误:检测到命名冲突

PNP 检测到致命错误

错误的“检测到组合循环”

[Vue警告]:检测到重复的密钥:x。这可能会导致更新错误

大幅度的错误:冲突的schemaIds:检测到类型A和B重复的schemaIds

无法修复警告检测到重复键:“ 0”。这可能会导致更新错误

出现“错误:插件/预设文件不允许导出对象,只能导出功能”。来自babel-preset-react-app / index.js

检测到对象可重复迭代

WinRAR是否检测到重复文件?

CRC错误检测和未检测到的错误概率

Babel插件/预设文件不允许导出对象,只能导出功能

如何在Babel 6中将参数传递给预设中的插件?

AutoRest 错误:(检测到重复操作(这很可能是由于 2 次操作使用相同的“operationId”或“tags”)

vue.js检测到重复的密钥:“ topic.ID”。这可能会导致更新错误。怎么了

Webpack - Babel 错误 - 找不到相对于目录的预设“@babel/env”

SWT错误地检测到按键组合

检测到错误的Node.js版本

打字稿未检测到类型错误

循环检测到@computed属性的错误

Leetcode#2,检测到循环错误

pytesseract检测到错误的整数值

SpriteKit错误地检测到多个碰撞

Git错误地检测到合并冲突

Cassandra 2.1错误-检测到泄漏