"TypeError: e.getAncestors is not a function" is thrown by a custom inline editor build
Is this a bug report or feature request? (choose one)
🐞 Bug report
💻 Version of CKEditor
v1.0.0-beta.2
📋 Steps to reproduce
- $ mkdir ck-test
- $ cd ck-test
- $ git clone -b stable https://github.com/ckeditor/ckeditor5-build-inline.git
- $ git clone -b stable https://github.com/ckeditor/ckeditor5-editor-inline.git
- $ cd ckeditor5-build-inline/
- Edit package.json to replace this line: @ckeditor/ckeditor5-editor-inline": "^1.0.0-beta.2" ...with: "@ckeditor/ckeditor5-editor-inline": "../ckeditor5-editor-inline/",
- $ npm install
- $ npm run build
- $ google-chrome sample/index.html
✅ Expected result
The editor works.
❎ Actual result
The editor throws an exception when converting the view to the model, in the Schema constructor ("context is not defined"):
index.html:36 TypeError: e.getAncestors is not a function
at new zg (schema.js:1134)
at Lg.on (schema.js:201)
at Lg.fire (emittermixin.js:195)
at Lg.(anonymous function) [as checkChild] (file://[...]/ck-test/ckeditor5-build-inline/build/ckeditor.js:5:126428)
at ul (paragraph.js:198)
at jg.n.upcastDispatcher.on (paragraph.js:87)
at jg.fire (emittermixin.js:195)
at jg._convertItem (upcastdispatcher.js:212)
at jg._convertChildren (upcastdispatcher.js:245)
at jg.<anonymous> (upcast-converters.js:340)
📃 Other details that might be useful
We're trying to update our custom headless builds from the second alpha to the second beta of CKEditor 5. We're attempting to modify the inline editor to become headless, but we can't even get a custom check-out of the inline editor to work. (If step six is omitted above, everything works.)
Hm... WFM:

Which version of npm do you have? I have some suspicion that the local ckeditor5-editor-inline pkg wasn't installed correctly.
I'm on npm 4.6.1
Thanks, @Reinmar. I was using npm 5.6.0 (which is the version installed by Fedora 27, which bundles nodejs 8.11.1, the current LTS release). For now, I have downgraded to nodejs 7.10.1 and npm 4.2.0 through n. Everything works well now.
npm 5 is known to cause troubles to pretty much everyone. However, I'm still worried about what's actually going on there. I have some suspicions that it comes to duplication of one or more packages, but we'd need to check that.
Anyway, the biggest issue that we have now is that the editor blows up when certain packages get duplicated (mainly – the engine). Of course, this situation is also bad for the code size too, but crashes are certainly more problematic.
One thing we're planning to do is https://github.com/ckeditor/ckeditor5/issues/667 – it shouldn't be necessary to import anything when writing a typical plugin.
The second thing will be to secure the utils package which may also cause issues (due to the emitter mixin and observables).
I'm closing your issue, but we'll certainly work on gradually improving this situation.
Thanks for your quick response, Piotr. Perhaps the documentation should mention that npm 5 is not supported, at least not when creating custom builds? (I see that there are Lerna issues as well.)
Hm... I thought we had the note there, but it turns out we mentioned that in https://docs.ckeditor.com/ckeditor5/latest/framework/guides/contributing/development-environment.html#requirements. I'll add it in https://docs.ckeditor.com/ckeditor5/latest/builds/guides/development/custom-builds.html and https://docs.ckeditor.com/ckeditor5/latest/builds/guides/integration/advanced-setup.html. Thanks!