'ERROR TypeError: spanEl.getBoundingClientRect is not a function
ERROR TypeError: spanEl.getBoundingClientRect is not a function
at _guessBsVersion (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:163317:25)
at isBs3 (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:163343:26)
at CarouselComponent.get isBs4 [as isBs4] (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:112171:90)
at Object.updateDirectives (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:132386:438)
at Object.updateDirectives (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:89094:39)
at checkAndUpdateView (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88585:14)
at callViewAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88951:21)
at execEmbeddedViewsAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88908:17)
at checkAndUpdateView (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88586:5)
at callViewAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88951:21)
ERROR TypeError: spanEl.getBoundingClientRect is not a function
at _guessBsVersion (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:163317:25)
at isBs3 (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:163343:26)
at CarouselComponent.get isBs4 [as isBs4] (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:112171:90)
at Object.updateDirectives (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:132386:438)
at Object.updateDirectives (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:89094:39)
at checkAndUpdateView (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88585:14)
at callViewAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88951:21)
at execEmbeddedViewsAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88908:17)
at checkAndUpdateView (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88586:5)
at callViewAction (C:\Users\sagar h\Desktop\MYRIDZ\falcon-mobikes-website\dist\server\main.js:88951:21)
I got this error while running npm run serve:ssr , after npm run build:ssr. After adding domino to server.ts file am getting this error.
Solution 1:[1]
Try adding this in your server.ts
after instantiating domino
(global as any).HTMLElement = window.HTMLElement;
(global as any).HTMLElement.prototype.getBoundingClientRect = () => {
return {right: '', left: '', top: '', bottom: ''};
};
Edit
You should instantiate domino
like this
const domino = require('domino');
const win = domino.createWindow('/path/to/browser/index.html');
global['window'] = win;
global['document'] = win.document;
global['navigator'] = win.navigator;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |