简体   繁体   English

在Windows中使用react storybook时出现未知插件“transform-decorators-legacy”错误

[英]Unknown plugin “transform-decorators-legacy” error when using react storybook in windows

I cloned a React project created on Linux to my Windows machine. 我将在Linux上创建的React项目克隆到我的Windows机器上。 The Project includes few react components and a storybook to test those components. 该项目包括一些反应组件和一个故事书来测试这些组件。 The "npm start" is configured to run the storybook at the "package.json" file: “npm start”配置为在“package.json”文件中运行故事书:

"start": "npm run storybook" “开始”:“npm run storybook”

After typing "npm start" I got this error on the browser console: 键入“npm start”后,我在浏览器控制台上收到此错误:

"Uncaught Error: Module build failed: ReferenceError: Unknown plugin "transform-decorators-legacy" specified in 'C:\\...\\node_modules\\@storybo ok\\ui\\node_modules\\react-treebeard\\.babelrc'". “未捕获错误:模块构建失败:ReferenceError:未知插件”transform-decorators-legacy“在'C:\\ ... \\ node_modules \\ @storybo ok \\ ui \\ node_modules \\ react-treebeard \\ .babelrc'中指定”。 This is my webpack.config.js file (the problem probably comes from there): 这是我的webpack.config.js文件(问题可能来自那里):

module.exports = (baseConfig, env) => {
  const config = genDefaultConfig(baseConfig, env);

  config.module.rules.push({
    use: {
      loader: 'babel-loader',
      options: {
        presets: [
          ['env', {
            modules: false
          }],
          'react',
          'flow'
        ],
        plugins: [
          'transform-class-properties',
          'transform-object-rest-spread',
          'flow-react-proptypes'
        ]
      }
    }
  });

  return config;
};

The commands runs with no errors under linux/mac. 这些命令在linux / mac下运行时没有错误。 The issue only occurs with windows. 该问题仅发生在Windows上。

node v8.5.0 npm v5.4.2 node v8.5.0 npm v5.4.2

I am having the same issue. 我有同样的问题。 Most are saying to make sure you exclude node_modules in your loaders section that has babel in it. 大多数人都说要确保在你的加载器部分中排除了包含babel的node_modules。

exclude: /node_modules/

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

相关问题 如何在Babel + transform-decorators-legacy中禁用定义类的属性 - How to disable defining class properties in Babel + transform-decorators-legacy 找不到模块'babel-plugin-transform-decorators-legacy' - Cannot find module 'babel-plugin-transform-decorators-legacy' React错误:使用Webpack时单词未知 - Error in React: unknown word when using webpack 在React中使用方法装饰器时将其绑定 - Bind this when using method decorators in React 当我尝试使用babel cli转换目录中的js文件时,“ReferenceError Unknown plugin” - “ReferenceError Unknown plugin” when I try to transform js files in a directory using babel cli 使用非传统装饰器时如何装饰 JavaScript class 构造函数? - How to decorate a JavaScript class constructor when using non-legacy decorators? 使用带有反应的 jquery 插件时导入错误 - error with imports when using jquery plugin with react 故事书:不使用反引号 after.attrs 时,对象作为 React 子项无效 - Storybook: Objects are not valid as a React child when not using backticks after .attrs 未找到兼容版本:babel-plugin-transform-decorators@^6.13.0 - No compatible version found: babel-plugin-transform-decorators@^6.13.0 TinyMCE 使用 Save 插件时 React 中出现“错误:未找到表单元素” - TinyMCE 'Error: No form element found' in React when using the Save plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM