简体   繁体   English

错误:无法从“/home/dolphin/sync/source/cruise-web”找到模块“@babel/plugin-proposal-decorators”

[英]Error: Cannot find module '@babel/plugin-proposal-decorators' from '/home/dolphin/sync/source/cruise-web'

When I using this command to build the project:当我使用此命令构建项目时:

yarn build

show this error:显示此错误:

[root@VM-0-16-centos cruise-web]# yarn build
yarn run v1.22.10
$ webpack --config config/dev.config.js
[webpack-cli] Compilation finished
assets by status 1.32 KiB [cached] 1 asset
./src/index.js 39 bytes [built] [code generated] [1 error]

ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/plugin-proposal-decorators' from '/home/dolphin/sync/source/cruise-web'
    at Function.resolveSync [as sync] (/home/dolphin/sync/source/cruise-web/node_modules/resolve/lib/sync.js:90:15)
    at resolveStandardizedName (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
    at resolvePlugin (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
    at loadPlugin (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
    at createDescriptor (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at /home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
    at Array.map (<anonymous>)
    at createDescriptors (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPluginDescriptors (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
    at plugins (/home/dolphin/sync/source/cruise-web/node_modules/@babel/core/lib/config/config-descriptors.js:40:19)

webpack 5.6.0 compiled with 1 error in 486 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

this is my package.json :这是我的package.json

{
  "name": "cruise-web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "axios": "^0.18.0",
    "lib-flexible": "^0.3.2",
    "postcss": "^8.1.9",
    "postcss-loader": "^4.1.0",
    "postcss-px2rem": "^0.3.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-redux": "^7.2.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "redux": "^4.0.1",
    "web-vitals": "^0.2.4"
  },
  "devDependencies": {
    "webpack": "5.6.0",
    "webpack-cli": "^4.2.0",
    "babel": "^6.23.0",
    "babel-loader": "^8.1.5",
    "@babel/core": "^7.11.4",
    "@babel/plugin-transform-react-jsx": "^7.10.4",
    "@babel/plugin-transform-react-jsx-self": "^7.10.4",
    "@babel/preset-env": "^7.11.0",
    "@babel/preset-react": "^7.10.4",
    "css-loader": "^4.2.2",
    "reactstrap": "^8.5.1",
    "style-loader": "^1.2.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "webpack --config config/dev.config.js",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "babel": {
    "plugins": [
      [
        "@babel/plugin-proposal-decorators",
        {
          "legacy": true
        }
      ]
    ],
    "presets": [
      "react-app"
    ]
  }
}

what should I do to fix this problem?我该怎么做才能解决这个问题?

You don't have that plugin listed in dependencies - you are trying to use it, but you haven't installed it.您没有在依赖项中列出该插件 - 您正在尝试使用它,但尚未安装它。

yarn add -D @babel/plugin-proposal-decorators should fix it. yarn add -D @babel/plugin-proposal-decorators应该修复它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Babel插件 - 提议装饰器未按预期工作 - Babel plugin-proposal-decorators not working as expected 如何使用 vite 启用“@babel/plugin-proposal-decorators” - How do i enable "@babel/plugin-proposal-decorators" with vite 错误:找不到模块“@babel/plugin-proposal-class-properties” - Error: Cannot find module '@babel/plugin-proposal-class-properties' 如何使用Babel 7的插件提议装饰器和异步函数来装饰异步方法? - How do I decorate an async method using Babel 7's plugin-proposal-decorators with an async function? 使用 Firebase 在 CodeSandbox 上找不到/安装 babel 插件“proposal-decorators” - Could not find/install babel plugin 'proposal-decorators' on CodeSandbox with Firebase 找不到模块'babel-plugin-transform-decorators-legacy' - Cannot find module 'babel-plugin-transform-decorators-legacy' Next.js:模块构建失败:错误:无法从“/home/ugurkaya/Desktop”中找到模块“react-hot-loader/babel” - Next.js: Module build failed: Error: Cannot find module 'react-hot-loader/babel' from '/home/ugurkaya/Desktop' 运行 React App 时找不到模块“@babel/plugin-transform-react-jsx-source” - Cannot find module '@babel/plugin-transform-react-jsx-source' when running React App React Native Typescript babel-plugin-module-resolver 错误:找不到模块或其对应的类型声明 - React Native Typescript babel-plugin-module-resolver error: Cannot find module or its corresponding type declerations React Native 报错:导出命名空间应该先由`@babel/plugin-proposal-export-namespace-from 转换 - React Native error: Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM