Plugin/Preset files are not allowed to export objects,webpack报错/babel报错的解决方法
1、为什么会报错 ?
这里抱着错误是因为 babel 的版本冲突。
多是因为你的 babel 依赖包不兼容。
可以查看你的 package.json 的依赖列表
即有 babel 7.0 版本的( @babel/core , @babel/preset-react )
也可命令查看 bebel-cli 的版本 ( babel -V )
也有 babel 6.0 版本的 ( babel-core@6.26.0 , babel-cli@6.26.0 , babel-preset-react@6.24.1 )
如果在你的 package.json 依赖包中既有 babel 7.0 版本,又有 babel 6.0 版本,就会报这个错误
很现实就是两个版本是不兼容的
2、处理方法
1、升级到 babel 7.0
将所有有关 babel 的包都升级为 7.0 版本
|
1
2
3
4
5
6
|
"@babel/core": "^7.0.0-beta.40","@babel/cli": "^7.0.0-beta.40","babel-loader": "^8.0.0-beta.0","babel-plugin-lodash": "^3.3.2","babel-plugin-react-transform": "^3.0.0","@babel/preset-react": "^7.0.0-beta.40",<br>"@babel/preset-stage-0":'^7.0.0' |
并且修改 .babelrc 文件
对应的修改 presets 预设和 plugins 都改为 7.0 形式。
|
1
2
3
4
|
query: { presets: ['@babel/react', '@babel/stage-0'], plugins: [''] } |
2、降级到 babel 6.0 版本
有时候我们看们的 package.json 里面都是 babel 6.0 版本的。
如下:
|
1
2
3
4
5
|
"babel-core": "^6.26.0","babel-loader": "^7.1.2","babel-plugin-transform-runtime": "^6.23.0","babel-preset-env": "^1.6.1","babel-preset-stage-0": "^6.24.1", |
但是还是报错,为什么呢?
你不妨把 node_modules 删掉,重新 install ,这样就可以处理一部分兼容问题
如果上面的方法还是不行。
你可以查看一下 babel-cli 的版本
|
1
|
babel -V |
如果是 babel-cli 7.0 版本。
那你就重新安装全局和本地的 babel-cli 版本为 6.0
|
1
2
3
|
npm install -g babel-cli@6.26.0yarn add babel-cli@6.26.0 |
基本上面两个方法可以解决所有兼容问题。
Plugin/Preset files are not allowed to export objects,webpack报错/babel报错的解决方法的更多相关文章
- babel版本兼容报错处理:Plugin/Preset files are not allowed to export objects
原文地址: https://www.cnblogs.com/jiebba/p/9618930.html 1.为什么会报错 ? 这里抱着错误是因为 babel 的版本冲突. 多是因为你的 babel 依 ...
- 【104】Maven3.5.0结合eclipse使用,提示Lambda expressions are allowed only at source level 1.8 or above错误的解决方法
错误重现 我的机器上安装了 maven 3.5.0,在 eclipse 中创建 maven 项目.pom.xml配置如下: <project xmlns="http://maven.a ...
- db2数据库表操作错误SQL0668N Operation not allowed for reason code "1" on table "表". SQLSTATE=57016的解决方法
错误sql Operation not allowed for reason code "1" on table "MARKET.PURE_USER".. SQ ...
- truncate at 255 characters with xlsx files(OLEDB方式读取Excel丢失数据、字符串截断的原因和解决方法)
The TypeGuessRows setting is supported by ACE. Note the version numbers in the key may change depend ...
- IIS7.5上的REST服务的Put,Delete操作发生HTTP Error 405.0 - Method Not Allowed 解决方法
WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...
- IIS7.5上的REST服务的Put操作发生HTTP Error 405.0 - Method Not Allowed 解决方法
WebDAV 是超文本传输协议 (HTTP) 的一组扩展,为 Internet 上计算机之间的编辑和文件管理提供了标准.利用这个协议用户可以通过Web进行远程的基本文件操作,如拷贝.移动.删除等.在I ...
- linux 打开文件数 too many open files 解决方法
linux 打开文件数 too many open files 解决方法 too many open files 出现这句提示的原因是程序打开的文件/socket连接数量超过系统设定值. 查看每个用户 ...
- Operation not allowed for reason code "7" on table 原因码 "7"的解决
对表进行任何操作都不被允许,提示SQLSTATE=57016 SQLCODE=-668 ,原因码 "7"的错误:SQL0668N Operation not allowed for ...
- 编译安装php时提示Cannot find MySQL header files的解决方法
php的配置文件中有一行--with-mysql=/usr/local/mysql ,安装的时候提示:configure: error: Cannot find MySQL header files ...
随机推荐
- PHPsql
下面员工3的薪水大于其主管的薪水,一条SQL找到薪水比下属低的主管 id username salary pid 1 a 3000 null 2 b 8000 null 3 c 5000 1 4 d ...
- 【vue】vue-router的用法
依赖安装:(c)npm install vue-router 过程: import Vue from 'vue'; import Router from 'vue-router'; Vue.use(R ...
- 010_动态语言与鸭子类型及python2和3的区别
一. 动态语言中经常提到鸭子类型,所谓鸭子类型就是:如果走起路来像鸭子,叫起来也像鸭子,那么它就是鸭子(If it walks like a duck and quacks like a duck, ...
- zookeeper的原理,5分钟了解zookeeper
一 .Zookeeper功能简介 ZooKeeper 是一个开源的分布式协调服务,由雅虎创建,是 Google Chubby 的开源实现.分布式应用程序可以基于 ZooKeeper 实现诸如数据发布/ ...
- 用for循环打印九九乘法表(for嵌套循环)
package com.Summer_0416.cn; /** * @author Summer * */ public class Test_Method10 { public static voi ...
- layer 查看图片
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- buildroot使用介绍
buildroot是Linux平台上一个构建嵌入式Linux系统的框架.整个Buildroot是由Makefile脚本和Kconfig配置文件构成的.你可以和编译Linux内核一样,通过buildro ...
- face recognition[variations of softmax][L-Softmax]
本文来自<Large-Margin Softmax Loss for Convolutional Neural Networks>,时间线为2016年12月,是北大和CMU的作品. 0 引 ...
- Python通过pip方式安装第三方模块的两种方式
一:环境 python3.6 windows 10 二:常用命令 如果直接执行pip命令报错,说明pip不在path环境变量中 解决方法: python -m pip list 以下默认可直接使用pi ...
- [翻译] .NET Standard 2.1 公布
[翻译] .NET Standard 2.1 公布 原文: Announcing .NET Standard 2.1 校对: Cloud 自从大约一年前发布 .NET Standard 2.0以来,我 ...