4

Getting an error with message "NotYetImplemented" from utils.js .

I get the error while using nodejs server, what this exact error means?

When I'm using "ng serve" there is no such error.

I'm using line chart from ng2-charts module.

Full Stack Trace:

ERROR Error: NotYetImplemented
    at HTMLCanvasElement.exports.nyi (/home/project15/web/node_modules/domino/lib/utils.js:41:9)
    at BaseChartDirective.ngOnInit (/home/project15/web/node_modules/ng2-charts/charts/charts.js:24:47)
    at checkAndUpdateDirectiveInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:12439:19)
    at checkAndUpdateNodeInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13966:20)
    at checkAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13909:16)
    at prodCheckAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14633:5)
    at Object.updateDirectives (/home/project15/web/dist-server/main.bundle.js:1:51133)
    at Object.updateDirectives (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14355:29)
    at checkAndUpdateView (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13875:14)
    at callViewAction (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14226:21)

Using the following:

NodeJS: 9.3.0

Angular: 5.1.2

OS: linux x64

"chart.js": "^2.7.1"

"ng2-charts": "^1.6.0"

EDIT :

setup for node server:

https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce

Error is visible in the terminal after accessing the web url, while running the command

node server.js
hagai
  • 424
  • 1
  • 7
  • 13
  • 1
    This is coming from domino, are you using that library or is it a dependency of another package? – Phix Jan 12 '18 at 21:40
  • I'm using "platform-server" module and it requires that. – hagai Jan 12 '18 at 21:47
  • 1
    Can you clarify what you mean by "when I use nodejs server"? – Phix Jan 12 '18 at 22:02
  • Meaning that i'm using the setup explained here to run an http server: https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce – hagai Jan 12 '18 at 22:16
  • Plus, "when I use nodejs server" means that I run in console the server: "node server.js" and while loading the page in the browser I can see the error back in the terminal. – hagai Jan 12 '18 at 22:21
  • @Phix can you assist? – hagai Jan 13 '18 at 10:40

1 Answers1

0

I had the same issue and solve it as below:

1- Create a boolean in your component .ts file and set its value like this

import { Inject, PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";

isBrowser: boolean;

constructor(@Inject(PLATFORM_ID) private platformId: unknown) {}

ngOnInit(): void {
    this.isBrowser = isPlatformBrowser(this.platformId);
}

2- Then in your HTML file use the ng2-charts HTML tag as below

<canvas *ngIf="isBrowser"
        baseChart
        ...
        ...
        ... >
</canvas>
Kamran Taghaddos
  • 452
  • 1
  • 10
  • 22