Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not install with Ember 4.1.0 #1202

Open
mattsimpson01 opened this issue Jan 5, 2022 · 4 comments
Open

Does not install with Ember 4.1.0 #1202

mattsimpson01 opened this issue Jan 5, 2022 · 4 comments

Comments

@mattsimpson01
Copy link

Issue: Ember server crashes after installing ember paper.
Error message - this.registerPlugin is not a function

ember-cli: 4.1.0
node: 16.3.0
os: linux x64

Steps to reproduce

npm install -g ember-cli
ember new etest --lang en
ember install ember-paper
ember server

Log file
ERROR Summary:

  • broccoliBuilderErrorStack: [undefined]
  • code: [undefined]
  • codeFrame: [undefined]
  • errorMessage: this.registerPlugin is not a function
  • errorType: [undefined]
  • location:
    • column: [undefined]
    • file: [undefined]
    • line: [undefined]
  • message: this.registerPlugin is not a function
  • name: TypeError
  • nodeAnnotation: [undefined]
  • nodeName: [undefined]
  • originalErrorMessage: [undefined]
  • stack: TypeError: this.registerPlugin is not a function
    at TemplateCompiler.registerPlugins (/home/matt/dev/_current/ember/etest/node_modules/ember-composability-tools/node_modules/ember-cli-htmlbars/index.js:63:16)
    at new TemplateCompiler (/home/matt/dev/_current/ember/etest/node_modules/ember-composability-tools/node_modules/ember-cli-htmlbars/index.js:42:10)
    at Object.toTree (/home/matt/dev/_current/ember/etest/node_modules/ember-composability-tools/node_modules/ember-cli-htmlbars/ember-addon-main.js:47:16)
    at /home/matt/dev/_current/ember/etest/node_modules/ember-cli-preprocess-registry/preprocessors.js:188:26
    at Array.forEach ()
    at processPlugins (/home/matt/dev/_current/ember/etest/node_modules/ember-cli-preprocess-registry/preprocessors.js:186:11)
    at module.exports.preprocessTemplates (/home/matt/dev/_current/ember/etest/node_modules/ember-cli-preprocess-registry/preprocessors.js:169:10)
    at Class.compileTemplates (/home/matt/dev/_current/ember/etest/node_modules/ember-cli/lib/models/addon.js:1138:35)
    at Class.compileAddon (/home/matt/dev/_current/ember/etest/node_modules/ember-cli/lib/models/addon.js:1200:42)
    at Class.treeForAddon (/home/matt/dev/_current/ember/etest/node_modules/ember-cli/lib/models/addon.js:856:26)
@umitozturk
Copy link

after ember v3.27.0 (May 3, 2021), registerPlugin / unregisterPlugin was deprecated. that's the reason why you're getting this error.

you can see in here: https://github.com/emberjs/ember.js/blob/master/CHANGELOG.md

@xiaobeiswift
Copy link

How to deal with it

@locks
Copy link

locks commented Aug 23, 2022

emberjs/ember.js#19429 (comment) you can try pinning ember-cli-htmlbars to the suggested version.

@jacobq
Copy link

jacobq commented Mar 2, 2023

In case it's helpful for someone else able to make a PR, here's a start:
https://github.com/jacobq/ember-paper/tree/fix-1202
Test suite is not passing, but it didn't pass when I tried to build on master or v1.0.0.-beta.36 either, and I am out of time to spend on this. If you want to do a quick check if it works in your application you can put this in your devDependencies:

    "ember-paper": "jacobq/ember-paper#1a041e10733ef5b3878e6fc3b68c023e6a73ad03",

I was able to get it to build with the following selective dependency resolution:

  "resolutions": {
    "ember-paper/ember-composability-tools": "^1.1.0"
  },

Without ember-composability-tools update I got "this.registerPlugin is not a function"
(at one point I also had "ember-paper/ember-css-transitions": "^3.1.0" for some reason but didn't need for simple case).

But then Ember.libraries.register('Ember Paper', '1.0.0-beta.36') caused a runtime error even though it built OK (Tested with ember-source: ~4.7.0).

Uncaught Error: Could not find module ember-resolver imported from etest/app

Annoyingly, the docs still say that Ember.libraries.register(libraryName, libraryVersion); is OK, but some GitHub searching shows otherwise.

Modifying ember-paper's index.js as follows (hacky as it is) corrected that error:

 treeForVendor(tree) {
    let trees = [];
    
    let versionTree = writeFile(
      'ember-paper/register-version.js',
      //`Ember.libraries.register('Ember Paper', '${version}');`
      `let Ember;
try {
  Ember = requireModule('ember')['default'];
} catch {
  Ember = window.Ember;
}
Ember?.libraries?.register('Ember Paper', '${version}');`
    );

Update: It looks like ember-paper is relying on ParentMixin from the older version of ember-composability-tools being used, but that was removed during octane migration, so there is some breakage that results from this update that still needs to be fixed before things will work right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants