ember-cli / ember-compatibility-helpers

Helpers that allow you to write backwards compat Ember addons
MIT License
24 stars 20 forks source link

Duplicate plugin/preset detected #52

Closed gzurbach closed 3 years ago

gzurbach commented 3 years ago

Hi there,

I am in the process of upgrading my app from Ember 3.20 to 3.24. After running npm install, I tried to run ember serve but I am getting the following error:

Build Error (broccoli-persistent-filter:Babel > [Babel: @ember/ordered-set]) in @ember/ordered-set/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/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js",
    "options": {
      "emberVersion": "3.24.4"
    },
    "dirname": "/Users/me/repos/webapp",
    "ownPass": false,
    "file": {
      "request": "/Users/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js",
      "resolved": "/Users/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js"
    }
  },
  {
    "alias": "/Users/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js",
    "options": {
      "emberVersion": "3.24.4"
    },
    "dirname": "/Users/me/repos/webapp",
    "ownPass": false,
    "file": {
      "request": "/Users/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js",
      "resolved": "/Users/me/repos/webapp/node_modules/ember-compatibility-helpers/comparision-plugin.js"
    }
  }
]

Stack Trace and Error Report: /var/folders/w8/42cj9tk940dgv89xv2t0j_5w0000gn/T/error.dump.06d4ce943e787ed424c67890ad69bf2e.log

I am not familiar enough with Babel at this point to understand what's going on. I am mostly curious to know if others had encountered this issue. I will do some digging as well and report back if I find anything.

gzurbach commented 3 years ago

In case this is useful, I ran npm list ember-compatibility-helpers in my app to see where it's used:

webapp@0.0.0 /Users/me/repos/webapp
├─┬ @ember/test-helpers@2.2.6
│ └─┬ ember-destroyable-polyfill@2.0.3
│   └── ember-compatibility-helpers@1.2.4
├─┬ @glimmer/component@1.0.3
│ └── ember-compatibility-helpers@1.1.2
├─┬ ember-cli-meta-tags@6.1.2
│ └── ember-compatibility-helpers@1.1.2  deduped
├─┬ ember-data@3.24.2
│ ├─┬ @ember-data/model@3.24.2
│ │ └── ember-compatibility-helpers@1.2.4
│ └─┬ @ember/ordered-set@4.0.0
│   └── ember-compatibility-helpers@1.1.2  deduped
├─┬ ember-flatpickr@3.0.1
│ └─┬ @ember/render-modifiers@1.0.2
│   └─┬ ember-modifier-manager-polyfill@1.2.0
│     └── ember-compatibility-helpers@1.2.2
├─┬ ember-router-scroll@4.0.0
│ ├─┬ ember-app-scheduler@5.1.2
│ │ ├── ember-compatibility-helpers@1.1.2  deduped
│ │ └─┬ ember-destroyable-polyfill@2.0.2
│ │   └── ember-compatibility-helpers@1.2.2
│ └── ember-compatibility-helpers@1.1.2  deduped
└─┬ ember-welcome-page@4.0.0
  └── ember-compatibility-helpers@1.1.2  deduped

I can see that @ember/ordered-set@4.0.0 has a dependency on ember-compatibility-helpers@1.1.2, which seem to be where things are blowing up?

YoranBrondsema commented 3 years ago

I'm seeing exactly the same error, also when upgrading to 3.24 (from 3.23). Like you, I don't know much about babel to understand what's going on... I'll look into it and will report if I find out anything.

YoranBrondsema commented 3 years ago

It looks like it's in ember-data 3.24. There's more info about the issue on this thread: https://github.com/emberjs/data/issues/7430

The proposed fix (npm --depth 20 update ember-compatibility-helpers) worked for me.

gzurbach commented 3 years ago

@YoranBrondsema Thanks for the tip! I ended up nuking my node_modules + package-lock.json then ran a fresh npm install which solved the issue 😄