Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error occurred: window is not defined #4

Open
Ayo-faks opened this issue Jul 11, 2024 · 2 comments
Open

Build error occurred: window is not defined #4

Ayo-faks opened this issue Jul 11, 2024 · 2 comments

Comments

@Ayo-faks
Copy link

Ayo-faks commented Jul 11, 2024

Describe the bug

When running npm run build on a non-Windows environment (Linux), the build fails 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. (/path/to/project/node_modules/echarts/dist/echarts.js:25:2)
at Module._compile (node
/modules/cjs/loader:1467:14)
at Module._extensions..js (node
/modules/cjs/loader:1551:10)
at Module.load (node
/modules/cjs/loader:1282:32)
at Module._load (node
/modules/cjs/loader:1098:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node
/modules/cjs/loader:215:24)

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

Add any other context about the problem here.

  • 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.

@kumarss20
Copy link
Contributor

Hey @Ayo-faks,

Thank you for bringing up the issue. I attempted to replicate the error but was unable to do so.

Here are the details:

  • Operating System: Red Hat Enterprise Linux (VERSION="9.3 (Plow)") on a GCP VM
  • npm: 8.19.4
  • Node: v16.20.2
  • Next.js: 13.5.6

@dhodapkarsoham
Copy link

I had to install echarts to make this error go away.

Run
sudo npm install echarts --legacy-peer-deps

Then run
sudo npm run build

This should work @Ayo-faks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants