node.js - 启动 vue js dev server 报错:.plugins[0] 可能只有二元组或三元组
问题描述
我正在使用 Vue CLI 版本 3 在 Docker 容器内运行 Vue 应用程序。要启动开发服务器,我运行:
https://cli.vuejs.org/guide/cli-service.html
这给出了以下错误:
ERROR Failed to compile with 1 errors 17:05:14
error in ./app/main.js
Module build failed (from ./node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js):
Error: .plugins[0] may only be a two-tuple or three-tuple
at assertPluginItem (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:235:13)
at arr.forEach (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:30)
at Array.forEach (<anonymous>)
at assertPluginList (/home/src/node_modules/@babel/core/lib/config/validation/option-assertions.js:222:9)
at Object.keys.forEach.key (/home/src/node_modules/@babel/core/lib/config/validation/options.js:107:5)
at Array.forEach (<anonymous>)
at validateNested (/home/src/node_modules/@babel/core/lib/config/validation/options.js:83:21)
at validate (/home/src/node_modules/@babel/core/lib/config/validation/options.js:74:10)
at file (/home/src/node_modules/@babel/core/lib/config/config-chain.js:174:34)
at cachedFunction (/home/src/node_modules/@babel/core/lib/config/caching.js:33:19)
at buildRootChain (/home/src/node_modules/@babel/core/lib/config/config-chain.js:120:36)
at loadPrivatePartialConfig (/home/src/node_modules/@babel/core/lib/config/partial.js:85:55)
at Object.loadPartialConfig (/home/src/node_modules/@babel/core/lib/config/partial.js:110:18)
at Object.<anonymous> (/home/src/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js:140:26)
at Generator.next (<anonymous>)
at asyncGeneratorStep (/home/src/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib/index.js:3:103)
@ multi (webpack)-dev-server/client/index.js ./node_modules/@vue/cli-service/node_modules/webpack/hot/dev-server.js ./app/main.js
我怀疑有问题的代码如下,在我的.babelrc
文件中:
"plugins": [
["transform-runtime", "transform-vue-jsx", "transform-regenerator", {
"polyfill": false,
"regenerator": true
}]
有人可以建议我如何解决这个问题吗?谢谢!
解决方案
你[
来错地方了。它应该是
"plugins": [
"transform-runtime",
"transform-vue-jsx",
["transform-regenerator", {
"polyfill": false,
"regenerator": true
}]
]
推荐阅读
- python - 如何编辑mnist数据集?
- python - pip install 即使使用 --no-cache-dir 也会产生哈希不匹配
- swift - 如何使用多个条件对数组进行排序,包括枚举值、名称和数字?
- php - 如何从 MySql 表中获取所有父母和祖先?
- javascript - Vuex动作中的顺序依赖函数
- apache-spark - java.io.IOException:在 Pyspark 中写入大文件时流损坏
- reactjs - 更改检测事件更改了 Ag Grid 单元格值
- c# - 它是安全的 serilog 配置作为 XML 配置而不是 .netframework 中的 c#
- multithreading - 我应该为可重新启动的多线程弹簧批处理使用哪个阅读器、编写器、处理器?
- python - Python:如何使用线性回归预测 NAN 值?