webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-env' from '...' - Did you mean "@babel/env"?
- webpack报错:
Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-env' from '...' - Did you mean "@babel/env"?
原因:
babel-core和babel-preset-env依赖被替换为@babel/core和@babel/preset-env,因为新版本的Babel7中对官方提供的依赖使用了命名空间@babel
npm install babel-loader babel-core babel-preset-env --save-dev
npm install babel-loader @babel/core @babel/preset-env --save-dev
解决:
在.babelrc文件或在webpack.config.js文件中,将原来的env替换为@babel/preset-env
// .babelrc
{
"presets": [
["env",
{
"modules": false
}
]
]
}
// webpack.config.js
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', { modules: false }]
}
}
}
]
}
webpack报错:Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-env' from '...' - Did you mean "@babel/env"?的更多相关文章
- webpack命令:Module build failed(from ./node_modules/babel-loader/lib/index.js)/405/错误解决
在项目中运行的时候出现报错,错误为Module build failed (from ./node_modules/babel-loader/lib/index.js) 解决方案: 控制台输入 np ...
- webpack 命令 Module build failed (from ./node_modules/babel-loader/lib/index.js) 错误问题解决方案
在项目中运行的时候出现报错,错误为Module build failed (from ./node_modules/babel-loader/lib/index.js) 解决方案: 控制台输入 np ...
- 初始化构建React+Ts项目时出现:Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssSyntaxError
具体错误 ERROR in ./src/index.tsx Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssS ...
- webpack搭建项目时出现的报错“Module build failed (from ./node_modules/css-loader/dist/cjs.js) CssSyntaxError”
控制台出现的错误如下: webpack.config.js中的配置如下: module.exports={ entry:'./src/main.js', output:{ path:__dirname ...
- vscode Springboot 启动debug报错:Build failed, do you want to continue?
一,前言 vscode我感觉是一个特别好用的开发工具,我根据文章https://www.cnblogs.com/WangBoBlog/p/9464281.html去搭建一个简单的springboot工 ...
- vue项目报错,解决Module build failed: Error: Cannot find module 'node-sass' 问题
1.报错问题 1 E:\WebStormFile\treehole-manage>npm run dev > xc-ui-pc-sysmanage@1.0.0 dev E:\WebStor ...
- Vue+Webpack配置css-loader时报错:Module build failed: Unknown word
使用Vue+Webpack搭建工程时,在webpack.config.js中的module的rules里针对各种文件配置加载工具.在针对css文件配置时遇到一个问题:打包构建时报错——Module b ...
- vue-cli 报Module build failed: Error: No parser and no file path given, couldn't infer a parser.错的解决方法
出错提示如下: ERROR Failed to compile with errors :: error in ./src/App.vue Module build failed: Error: No ...
- vue.js报错:Module build failed: Error: No parser and no file path given, couldn't infer a parser.
ERROR Failed to compile with 2 errors 12:00:33 error in ./src/App.vue Module build failed: Error: No ...
随机推荐
- transform子元素,绝对定位失效
公司项目需要上拉刷新功能, mui下拉刷新组件采用固定布局,无法触发浏览器自带的隐藏地址栏功能. 思路: touchmove事件监听程序中,判断滚动位置:上下顶点使用transform 移动最外层容器 ...
- <Yarn> <Capacity Scheduler> <Source Code>
Yarn capacity scheduler 首先要知道, [Attention: RM有两个组件,其中Scheduler完全就只是负责资源的分配:ApplicationsManager则负责接受a ...
- github咋用昂
github-trend:https://github.com/trending github-usingway:https://zhuanlan.zhihu.com/p/41899093 githu ...
- golang快速扫描
利用golang的并发优势快速扫描端口 Scanner startIp [endIp] port thread package main import ( "flag" " ...
- 查询表Or列的注释信息
需求:开发人员需要DBA支持,查询表的注释说明,用于明确表的用途. 1.测试 session 1 创建测试表SQL> create table a_emp as select * from sc ...
- 田螺便利店—PyCharm安装第三方库
PyCharm安装第三方库是十分方便的,无需pip或其他工具,平台就自带了这个功能而且操作十分简便.如下: 1. 打开软件,点击左上角“文件(File)”—>“设置(setting)”: 2. ...
- iOS常用的代码块整理
strong @property (nonatomic,strong) <#Class#> *<#object#>; weak @property (nonatomic,wea ...
- 专题--XOR之线性基
没想到xor居然和线性代数有着那么有趣的联系哎 n个数可以转化为一个上三角矩阵 (线性无关?!) 链接:https://www.nowcoder.com/acm/contest/180/D来源:牛客 ...
- HDU 2048:神、上帝以及老天爷(错排公式,递推)
神.上帝以及老天爷 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- 第15次Scrum会议(10/27)【欢迎来怼】
一.小组信息 队名:欢迎来怼 小组成员 队长:田继平 成员:李圆圆,葛美义,王伟东,姜珊,邵朔,冉华 小组照片 二.开会信息 时间:2017/10/27 17:20~17:45,总计25min. 地点 ...