node.js - 模块构建失败 : Error: Couldn't find preset "stage-0" relative to directory

标签 node.js npm webpack

我收到以下错误,但仅当我尝试使用以下依赖项时才会出现,否则它会正常工作。

错误:

Module build failed: Error: Couldn't find preset "stage-0" relative to directory

导致问题的导入

从“material-ui”导入 {ActionDone}

它是 react-material-icons npm 包的一部分。如果我删除该导入并使用它,一切正常。我错过了什么?

最佳答案

你只需要安装babel-preset-stage-0:

命令:

npm install --save-dev babel-preset-stage-0

关于node.js - 模块构建失败 : Error: Couldn't find preset "stage-0" relative to directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44751216/

相关文章:

javascript - 带 babel 的 NPM 7 工作区 - 在工作区之间导入

javascript - 使用 webpack 时出现错误 : Cannot 'file' or 'directory' ./lib/React

javascript - 无法通过 npm 脚本运行 babel "babel: command not found"

javascript - 在 Node.js 中,如何将字符串转换为 json?

node.js - npm coffescript安装错误

vue.js - 如何修复 vue-cli-service 漏洞?

javascript - 反射(reflect)开发服务器中的更改,无需重新加载 Node 服务器(Webpack 和 Vue-cli)

reactjs - 如何在 React 和 Webpack 项目中使用来自sharp模块的图像

node.js - 将公共(public)依赖项导入 package.json?

node.js - ObjectionJS关系模型类未定义