Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix BrowserslistError in vue.js?

Tags:

vue.js

vue-cli

I created a project with vue create command, changed the directory and used npm run serve command. The error came up.

I tried updating the npm packages, but it didn't work.

 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
like image 348
Peter Luczynski Avatar asked Aug 11 '19 11:08

Peter Luczynski


1 Answers

Either delete .browserslistrc file or delete field "browserslist" in package.json.

like image 115
Andrew Vasilchuk Avatar answered Sep 29 '22 07:09

Andrew Vasilchuk