How to Resolve window is not defined Error in Neo4j's Neoconverse Project on Linux?

Hello Neo4j Community,

I’m encountering an issue when running npm run build for Neo4j's Neoconverse project. The build works perfectly on a Windows environment, but it fails on a non-Windows environment (Linux) with the following error:

ReferenceError: window is not defined
    at detect (/path/to/project/node_modules/echarts/dist/echarts.js:123:54)
    at /path/to/project/node_modules/echarts/dist/echarts.js:97:9
    at /path/to/project/node_modules/echarts/dist/echarts.js:22:68
    at Object.<anonymous> (/path/to/project/node_modules/echarts/dist/echarts.js:25:2)
    at Module._compile (node:internal/modules/cjs/loader:1467:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)

Steps to Reproduce:

  1. Clone the repository.
  2. Run npm install --legacy-peer-deps.
  3. Run npm run build on a non-Windows environment (e.g., Ubuntu).

Expected Behavior:

The build should succeed without any errors, as it does on a Windows environment.

Additional Context:

  • Node.js version: [e.g., 16.x]
  • NPM version: [e.g., 7.x]
  • Operating System: [e.g., Ubuntu 20.04]

Thank you!

Thank you for your assistance in resolving this issue. Any insights or suggestions would be greatly appreciated!

I've been looking into this but I haven't been able to reproduce the issue yet. I see in the response for version numbers it lists Node.js [e.g., 16x.], NPM version [e.g., 7.x], Operating System: [e.g., Ubuntu 20.04].

Could you provide the exact version numbers you are using for those 3 items? That will help us reproduce the issue. Thanks!