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.

Running yarn dev after a fresh clone & install fails due to duplicate babel plugin/preset

See original GitHub issue

Hi! I just started your course and ran into an issue getting up and running. Upon running yarn dev, I see this error:

➜ yarn dev
yarn run v1.22.5
$ node ./server/index.js
⠋ Building...Serving on http://localhost:3000
🚨  /Users/josie.flynn/dev/professional-ts/src/index.js: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.

  plugins: [
    ['some-plugin', {}],
    ['some-plugin', {}, 'some unique name'],
  ]

Duplicates detected are:
[
  {
    "alias": "/Users/josie.flynn/dev/professional-ts/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
    "dirname": "/Users/josie.flynn/dev/professional-ts",
    "ownPass": false,
    "file": {
      "request": "@babel/plugin-proposal-class-properties",
      "resolved": "/Users/josie.flynn/dev/professional-ts/node_modules/@babel/plugin-proposal-class-properties/lib/index.js"
    }
  },
  {
    "alias": "base$1",
    "options": {
      "loose": "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"
    },
    "dirname": "/Users/josie.flynn/dev/professional-ts",
    "ownPass": false

I think this is happening because @babel/preset-env now includes the @babel/plugin-proposal-class-properties proposal as of their 7.10.0 release: https://babeljs.io/blog/2020/05/25/7.10.0#class-properties-and-private-methods-to-shippedproposals-option-of-babelpreset-env-11451httpsgithubcombabelbabelpull11451

Commenting out "plugins": ["@babel/plugin-proposal-class-properties"] from .babelrc seems to resolve the issue for me.

Thanks for putting your course together, it’s been great so far! Just wanted to submit this in case it helps other folks who got stuck on it too.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:42
  • Comments:6

github_iconTop GitHub Comments

10reactions
florozcommented, May 3, 2021

Hi! I just started your course and ran into an issue getting up and running. Upon running yarn dev, I see this error:

➜ yarn dev
yarn run v1.22.5
$ node ./server/index.js
⠋ Building...Serving on http://localhost:3000
🚨  /Users/josie.flynn/dev/professional-ts/src/index.js: Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.

  plugins: [
    ['some-plugin', {}],
    ['some-plugin', {}, 'some unique name'],
  ]

Duplicates detected are:
[
  {
    "alias": "/Users/josie.flynn/dev/professional-ts/node_modules/@babel/plugin-proposal-class-properties/lib/index.js",
    "dirname": "/Users/josie.flynn/dev/professional-ts",
    "ownPass": false,
    "file": {
      "request": "@babel/plugin-proposal-class-properties",
      "resolved": "/Users/josie.flynn/dev/professional-ts/node_modules/@babel/plugin-proposal-class-properties/lib/index.js"
    }
  },
  {
    "alias": "base$1",
    "options": {
      "loose": "#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error"
    },
    "dirname": "/Users/josie.flynn/dev/professional-ts",
    "ownPass": false

I think this is happening because @babel/preset-env now includes the @babel/plugin-proposal-class-properties proposal as of their 7.10.0 release: https://babeljs.io/blog/2020/05/25/7.10.0#class-properties-and-private-methods-to-shippedproposals-option-of-babelpreset-env-11451httpsgithubcombabelbabelpull11451

Commenting out "plugins": ["@babel/plugin-proposal-class-properties"] from .babelrc seems to resolve the issue for me.

Thanks for putting your course together, it’s been great so far! Just wanted to submit this in case it helps other folks who got stuck on it too.

This worked for me too! thanks

// .babelrc.js
{
  "presets": [
    ["@babel/preset-env", { "targets": { "node": "10" } }],
    "@babel/preset-react",
    "@babel/preset-typescript"
  ]
  // "plugins": ["@babel/plugin-proposal-class-properties"]
}

0reactions
satyambnsalcommented, May 18, 2022

Thank you ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webencore Fails : Duplicate plugin/preset detected
Simple solution: just delete the "^" in "@babel/preset-react": "^7.0.0", from your package.json file, And run the npm install command after ...
Read more >
@babel/preset-react | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
First, we need to install the Babel Rollup plugin and the appropriate Babel preset. # Install Rollup's Babel plugin. npm install --save-dev rollup-plugin-babel...
Read more >
Babel issue running npm run dev after upgrade to Mix
Try deleting the node_modules folder and the package-lock.json file and run npm install again. Also check if you have any old dependencies or...
Read more >
How to Create and Publish a React Component Library
npm install @my-github-account/my-cool-component-library ... You can initialize a default configuration by running the following command:.
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