embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
339 stars 137 forks source link

Error in compat mode for addon: this.packageCache.seed is not a function #520

Open knownasilya opened 4 years ago

knownasilya commented 4 years ago
 - broccoliBuilderErrorStack: [undefined]
  - code: [undefined]
  - codeFrame: [undefined]
  - errorMessage: this.packageCache.seed is not a function
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: this.packageCache.seed is not a function
  - name: TypeError
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: TypeError: this.packageCache.seed is not a function
    at new V1DummyApp (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/v1-app.js:592:27)
    at Function.create (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/v1-app.js:42:20)
    at new V1InstanceCache (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/v1-instance-cache.js:24:37)
    at core_1.getOrCreate (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/v1-instance-cache.js:33:72)
    at Object.getOrCreate (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/core/src/get-or-create.js:6:18)
    at Function.forApp (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/v1-instance-cache.js:33:31)
    at new CompatAddons (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/compat-addons.js:26:51)
    at Object.defaultPipeline [as compatBuild] (/home/travis/build/knownasilya/ember-toastr/node_modules/@embroider/compat/src/default-pipeline.js:17:18)
    at module.exports (/home/travis/build/knownasilya/ember-toastr/ember-cli-build.js:20:8)
    at Builder.readBuildFile (/home/travis/build/knownasilya/ember-toastr/node_modules/ember-cli/lib/models/builder.js:49:14)

Test: https://travis-ci.org/github/knownasilya/ember-toastr/jobs/726640814 Code: https://github.com/knownasilya/ember-toastr

ef4 commented 4 years ago

This sounds like a version skew problem. Do you have multiple mismatched versions of the embroider packages?

knownasilya commented 4 years ago

Maybe this has to do with adding @embroider/core as a dep to ember-try:

 name: 'embroider-tests',
        npm: {
          devDependencies: {
            '@embroider/core': '*',
            '@embroider/webpack': '*',
            '@embroider/compat': '*',
          },
        },

Since the other two might depend on that already.

knownasilya commented 4 years ago

Ah, nvm, those use a peerDep.

Looks like it's this:

=> Found "@embroider/core@0.4.3"
info Reasons this module exists
   - "ember-auto-import" depends on it
   - Hoisted from "ember-auto-import#@embroider#core"
   - Hoisted from "ember-auto-import#@embroider#core#@embroider#macros#@

Which is "ember-auto-import": "^1.6.0",

dknutsen commented 4 years ago

I had the same thing happening in my addon. In my case I wasn't using ember-auto-import so I just removed it and that cleared it up.