question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Version

3.0.0-beta.6

Reproduction link

https://codepen.io/

Steps to reproduce

  • Vue CLI v3.0.0-beta.6
  • ? Please pick a preset: Manually select features
  • ? Check the features needed for your project: TS, Router, Vuex, CSS Pre-processors, Linter
  • ? Use class-style component syntax? Yes
  • ? Use Babel alongside TypeScript for auto-detected polyfills? Yes
  • ? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): LESS
  • ? Pick a linter / formatter config: Airbnb
  • ? Pick additional lint features:
  • ? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files
  • ? Save this as a preset for future projects? No

vue-cli will install @babel/preset-stage-2@7.0.0-beta.45 and npm run serve will throw error:

The new decorators proposal is not supported yet. You must pass the “decoratorsLegacy”: true option to @babel/preset-stage-2

see: https://github.com/babel/babel/blob/master/packages/babel-preset-stage-2/src/index.js#L29

forgive my poor English

What is expected?

server success

What is actually happening?

The new decorators proposal is not supported yet. You must pass the "decoratorsLegacy": true option to @babel/preset-stage-2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:65
  • Comments:26 (1 by maintainers)

github_iconTop GitHub Comments

39reactions
nitta-honokacommented, Apr 24, 2018

I had solved the problem by using a custom config by @babel/preset-env in file .babelrc. Working well, like this:

{
  "presets": [
    ["@babel/preset-env", {
      "targets": {
        "browsers": [
          "> 5%",
          "last 2 versions",
          "not ie <= 8"
        ]
      },
      "modules": false,
      "exclude": [
        "transform-regenerator"
      ]
    }],
    ["@babel/preset-stage-2", {
      "useBuiltIns": true,
      "decoratorsLegacy": true
    }]
  ],
  "plugins": [
  ]
}
31reactions
ftgibrancommented, Apr 25, 2018

Guys while this issue is not fixed, simply use this temporary solution: Specify the old version of @babel/preset-stage-2 in devDependencies

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

then run npm run install

Read more comments on GitHub >

github_iconTop Results From Across the Web

Starting the dev server in project generated by vue cli 3
This created a vue-projject foler. Then I changed the directory into that folder and ran npm run serve command. But i get the...
Read more >
Starting the dev server in project generated by vue cli 3
This created a vue-projject foler. Then I changed the directory into that folder and ran npm run serve command. But i get the...
Read more >
babel/preset-stage-2
As of Babel v7, all the stage presets have been deprecated. ... npm install --save-dev @babel/preset-stage-2. Copy. Usage. With a configuration file ...
Read more >
vue.js - vue-cli(3.0.0-beta.6)创建项目后使用yarn serve就报错
或者github的其他解决方案:npm run serve error: You must pass the "decoratorsLegacy": true option to @babel/preset-stage-2.
Read more >
在vue cli 3生成的项目中启动dev服务器 - CSDN博客
然后我将目录更改为该文件夹并运行npm run serve命令. ... You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-2 (While ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found