DarioMagniPLRM commented on issue #19233:
URL: https://github.com/apache/echarts/issues/19233#issuecomment-1787464643

   @Uzlopak 
   I tried using node v21.1.0: the error is still present but different.
   
   ``` txt
   
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:123
           env.touchEventsSupported = 'ontouchstart' in window && !browser.ie 
&& !browser.edge;
                                                        ^
   
   ReferenceError: window is not defined
       at detect 
([...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:123:54)
       at 
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:97:9
       at 
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:22:68
       at Object.<anonymous> 
([...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:25:2)
       at Module._compile (node:internal/modules/cjs/loader:1376:14)
       at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
       at Module.load (node:internal/modules/cjs/loader:1207:32)
       at Module._load (node:internal/modules/cjs/loader:1023:12)
       at Module.require (node:internal/modules/cjs/loader:1235:19)
       at require (node:internal/modules/helpers:176:18)
   
   Node.js v21.1.0
   ```
   [...] = my project folder
   
   ----------------------------------------------
   
   I tried also to apply the solution proposed by @mahdi-shojaee, adding 
_jsdom_ before _echarts_ import
   
   ``` ts
   import { JSDOM } from 'jsdom'
   
   const { window } = new JSDOM();
   global.window = window;
   global.document = window.document;
   
   import * as echarts from 'echarts'
   ```
   
   The error is still present, but different:
   
   ``` txt
   
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:16598
         document.documentElement.lang || navigator.language || 
navigator.browserLanguage).toUpperCase();
                                                                                
           ^
   
   TypeError: Cannot read properties of undefined (reading 'toUpperCase')
       at 
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:16598:89
       at 
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:16600:6
       at 
[...]\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:22:68
       at Object.<anonymous> 
(D:\GitHub\math-engine\node_modules\.pnpm\[email protected]\node_modules\echarts\dist\echarts.js:25:2)
       at Module._compile (node:internal/modules/cjs/loader:1376:14)
       at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
       at Module.load (node:internal/modules/cjs/loader:1207:32)
       at Module._load (node:internal/modules/cjs/loader:1023:12)
       at Module.require (node:internal/modules/cjs/loader:1235:19)
       at require (node:internal/modules/helpers:176:18)
   
   Node.js v21.1.0
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to