Vue-cli (3.0.0-beta.6) uses yarn serve to report an error after creating a project

 ERROR  Failed to compile with 1 errors                                                                                                                                   14:33:04

 error  in ./src/main.js

Module build failed: Error: [BABEL] /Users/zhangwei/Company/Qtay//xfind-web/src/main.js: The new decorators proposal is not supported yet. You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-2 (While processing: "/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@vue/babel-preset-app/index.js$1")
    at /Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/preset-stage-2/lib/index.js:107:11
    at /Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/helper-plugin-utils/lib/index.js:18:12
    at /Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:172:14
    at cachedFunction (/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/caching.js:42:17)
    at loadPresetDescriptor (/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:243:63)
    at /Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:68:19
    at Array.map (<anonymous>)
    at recurseDescriptors (/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:66:36)
    at recurseDescriptors (/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:97:26)
    at loadFullConfig (/Users/zhangwei/Company/Qtay//xfind-web/node_modules/@babel/core/lib/config/full.js:112:6)

 @ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.js
Mar.05,2021

github has begun to work around it. Click here


add" devDependencies "to the devDependencies in package.json: {
" @ babel/preset-stage-2 ":" 7.0.0-beta.44 ",
.
}


"devDependencies": {

"autoprefixer": "^8.3.0",
"@babel/preset-stage-2": "7.0.0-beta.45",

}

lower the version and don't use the new version for the time being.


first of all, vue-cli3.0 is currently in public beta, so it is not recommended to use it for actual projects until the official version. There are also instructions in the document:
Most of the planned features are in place but there may still be bugs. API may still change until we reach RC phase. Do not use in production yet unless you are adventurous.
roughly means: we have roughly developed the functionality, but there may still be vulnerabilities. API may also change before a candidate version of (RC) is released. Don't use it in production unless you are adventurous.

back to your problem, the above has provided some solutions:
for example, add @ babel/preset-stage-2:

to the devDependencies in package.json.
"devDependencies": {
    "@babel/preset-stage-2": "7.0.0-beta.44",
    ...
}

or other github solutions: npm run serve error: You must pass the " decoratorsLegacy ": true option to @ babel/preset-stage-2

or upgrade version, today vue-cli released 3.0.0-beta.7 (recommended)

Menu