gpt4 book ai didi

vue.js - 如何修复vue.js中的BrowserslistError?

转载 作者:行者123 更新时间:2023-12-03 06:39:32 24 4
gpt4 key购买 nike

我使用vue create命令创建了一个项目,更改了目录并使用了npm run serve命令。错误出现了。
我尝试更新npm软件包,但没有成功。

 error  in ./src/main.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
BrowserslistError: [BABEL] C:\Users\peter\test\src\main.js: C:\Users\peter\test contains both browserslist and package.json with browsers (While processing: "C:\\Users\\peter\\test\\node_modules\\@vue\\babel-preset-app\\index.js")
at C:\Users\peter\test\node_modules\browserslist\node.js:263:15
at eachParent (C:\Users\peter\test\node_modules\browserslist\node.js:47:18)
at Object.findConfig (C:\Users\peter\test\node_modules\browserslist\node.js:246:20)
at Function.loadConfig (C:\Users\peter\test\node_modules\browserslist\node.js:177:37)
at browserslist (C:\Users\peter\test\node_modules\browserslist\index.js:333:31)
at getTargets (C:\Users\peter\test\node_modules\@babel\preset-env\lib\targets-parser.js:184:50)
at getPolyfills (C:\Users\peter\test\node_modules\@vue\babel-preset-app\index.js:20:26)
at module.exports (C:\Users\peter\test\node_modules\@vue\babel-preset-app\index.js:106:17)
at loadDescriptor (C:\Users\peter\test\node_modules\@babel\core\lib\config\full.js:165:14)
at cachedFunction (C:\Users\peter\test\node_modules\@babel\core\lib\config\caching.js:33:19)
at loadPresetDescriptor (C:\Users\peter\test\node_modules\@babel\core\lib\config\full.js:235:63)
at config.presets.reduce (C:\Users\peter\test\node_modules\@babel\core\lib\config\full.js:77:21)
at Array.reduce (<anonymous>)
at recurseDescriptors (C:\Users\peter\test\node_modules\@babel\core\lib\config\full.js:74:38)
at loadFullConfig (C:\Users\peter\test\node_modules\@babel\core\lib\config\full.js:108:6)
at process.nextTick (C:\Users\peter\test\node_modules\@babel\core\lib\transform.js:28:33)

@ multi (webpack)-dev-server/client?http://192.168.2.117:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

最佳答案

删除.browserslistrc文件或删除"browserslist"中的字段package.json

关于vue.js - 如何修复vue.js中的BrowserslistError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57449451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com