Suppadeliux
Suppadeliux

Reputation: 1

Error Cannot read properties of undefined (reading 'replace') with ngx-monaco-editor-v2 version 16 and Angular 16

I am facing an issue with monaco-editor, specifically since version 16 of ngx-monaco-editor-v2, monaco-editor v0.41, and angular v16.

The error in console is Cannot read properties of undefined (reading 'replace'), here's a screenshot of the error

error monaco editor

Angular is running in development mode.
nls.ts:53 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
    at L (nls.ts:53:20)
    at Object.localize (nls.ts:106:10)
    at editorOptions.ts:5680:30
    at s._invokeFactory (loader.js:1203:41)
    at s.complete (loader.js:1213:36)
    at s._onModuleComplete (loader.js:1843:20)
    at s._onModuleComplete (loader.js:1855:30)
    at s._onModuleComplete (loader.js:1855:30)
    at s._resolve (loader.js:1800:22)
    at s.defineModule (loader.js:1443:18)
L @ nls.ts:53
(anonymous) @ nls.ts:106
(anonymous) @ editorOptions.ts:5680
s._invokeFactory @ loader.js:1203
s.complete @ loader.js:1213
s._onModuleComplete @ loader.js:1843
s._onModuleComplete @ loader.js:1855
s._onModuleComplete @ loader.js:1855
s._resolve @ loader.js:1800
s.defineModule @ loader.js:1443
o @ loader.js:1728
b @ nls.ts:192
s._invokeFactory @ loader.js:1203
s.complete @ loader.js:1213
s._onModuleComplete @ loader.js:1843
s._onModuleComplete @ loader.js:1855
s._resolve @ loader.js:1800
s.defineModule @ loader.js:1443
g @ loader.js:1893
(anonymous) @ editor.main.nls.js:11

I tried bumping all to version 17 with angular 17, and still facing the same issue.

I also tried to just declare a basic in html, just basic config, but same result with error in console, and broken editor.

Here's my package.json:


"dependencies": {
        "@angular/animations": "^16.2.12",
        "@angular/cdk": "^16.2.12",
        "@angular/common": "^16.2.12",
        "@angular/compiler": "^16.2.12",
        "@angular/core": "^16.2.12",
        "@angular/forms": "^16.2.12",
        "@angular/localize": "^16.2.12",
        "@angular/platform-browser": "^16.2.12",
        "@angular/platform-browser-dynamic": "^16.2.12",
        "@angular/router": "^16.2.12",
        "@fortawesome/fontawesome-free": "^6.1.1",
        "@nebular/eva-icons": "12.0.0",
        "@nebular/theme": "12.0.0",
        "@ng-bootstrap/ng-bootstrap": "~15.0.0",
        "@ngx-translate/core": "^15.0.0",
        "@ngx-translate/http-loader": "^8.0.0",
        "@popperjs/core": "^2.11.8",
        "bootstrap": "5.2.0",
        "chart.js": "^3.9.1",
        "chartjs-adapter-moment": "^1.0.1",
        "d3": "^7.8.0",
        "eva-icons": "^1.1.3",
        "file-saver-es": "^2.0.5",
        "font-awesome-animation": "0.2.1",
        "js-yaml": "^4.1.0",
        "moment": "^2.29.4",
        "monaco-editor": "^0.41.0",
        "ngx-monaco-editor-v2": "^16.0.1",
        "normalize.css": "6.0.0",
        "pace-js": "1.0.2",
        "pako": "^2.1.0",
        "popper.js": "^1.16.1",
        "rxjs": "6.6.7",
        "socket.io-client": "^2.4.0",
        "tslib": "^2.4.0",
        "zone.js": "~0.13.3"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "^16.2.14",
        "@angular-eslint/builder": "16.3.1",
        "@angular-eslint/eslint-plugin": "16.3.1",
        "@angular-eslint/eslint-plugin-template": "16.3.1",
        "@angular-eslint/schematics": "16.3.1",
        "@angular-eslint/template-parser": "16.3.1",
        "typescript": "~4.9.5",
    },

I found 2 issues about the error, but they seem not to be related https://github.com/microsoft/monaco-editor/issues/1192 https://github.com/Microsoft/monaco-editor/issues/1321

Thanks in advance for any help

Upvotes: 0

Views: 734

Answers (0)

Related Questions