Kolong Kinghu
Kolong Kinghu

Reputation: 41

Cannot create monaco editor

When trying to create monaco editor from https://github.com/Microsoft/monaco-editor I get this.model.onDidChangeRawContentFast is not a function

ERROR Error: Uncaught (in promise): TypeError: 

this.model.onDidChangeRawContentFast is not a function
TypeError: this.model.onDidChangeRawContentFast is not a function
    at ViewModel.push../node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js.ViewModel._registerModelEvents (viewModelImpl.js:141)
    at new ViewModel (viewModelImpl.js:68)
    at StandaloneEditor.push../node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js.CodeEditorWidget._attachModel (codeEditorWidget.js:939)
    at StandaloneEditor.push../node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.StandaloneEditor._attachModel (standaloneCodeEditor.js:198)
    at new StandaloneEditor (standaloneCodeEditor.js:180)
    at standaloneEditor.js:57
    at withAllStandaloneServices (standaloneEditor.js:44)
    at Object.create (standaloneEditor.js:56)
    at MonacoComponent.<anonymous> (monaco.component.ts:167)
    at step (tslib.es6.js:97)
    at resolvePromise (zone.js:831)
    at new ZoneAwarePromise (zone.js:913)
    at Module.__awaiter (tslib.es6.js:67)
    at MonacoComponent.push../Source/app/shared/components/monaco/monaco.component.ts.MonacoComponent._createEditor (monaco.component.ts:158)
    at MonacoComponent.push../Source/app/shared/components/monaco/monaco.component.ts.MonacoComponent.ngAfterViewInit (monaco.component.ts:102)
    at callProviderLifecycles (core.js:22406)
    at callElementProvidersLifecycles (core.js:22380)
    at callLifecycleHooksChildrenFirst (core.js:22370)
    at checkAndUpdateView (core.js:23306)
    at callViewAction (core.js:23538)

This is on angular 7

import * as monaco from 'monaco-editor';
monaco.editor.create(this.editorContainer.nativeElement);

I installed this via esm aka npm install monaco-editor, the package.json looks right. Has anyone come across this error?

Upvotes: 0

Views: 2510

Answers (1)

Kolong Kinghu
Kolong Kinghu

Reputation: 41

I got it fixed, I had an old version installed via CDN and there was some conflicts there. Removing the old package completely removed the error :)

Upvotes: 0

Related Questions