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

[bug]: Following new-design tutorial leads to echarts error #6543

Open
vladh opened this issue Apr 11, 2024 · 1 comment
Open

[bug]: Following new-design tutorial leads to echarts error #6543

vladh opened this issue Apr 11, 2024 · 1 comment
Labels
🐛 bug Something isn't working

Comments

@vladh
Copy link

vladh commented Apr 11, 2024

What seems to be the problem? 🤔

Steps to reproduce:

$ npx @freesewing/new-design
$ cd freesewing
$ yarn dev

At this point I get the following error (not what this issue is about):

yarn run v1.22.21                                                                                                                                                                                                                                             
$ next dev -p 8000                                                                                                                                                                                                                                            
/bin/sh: line 1: next: command not found                                                                                                                                                                                                                      
error Command failed with exit code 127.                                                                                                                                                                                                                      
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So I run yarn (perhaps this should be added to the tutorial?):

$ yarn
$ yarn dev

The initial build succeeds, and I can visit http://localhost:8000. However, on clicking “from scratch” (or “tutorial” or “from X”), I get a stack trace in my browser and console:

 ⨯ ReferenceError: window is not defined
    at detect (/tmp/freesewing/node_modules/echarts/dist/echarts.js:123:54)
    at /tmp/freesewing/node_modules/echarts/dist/echarts.js:97:9
    at /tmp/freesewing/node_modules/echarts/dist/echarts.js:22:68
    at Object.<anonymous> (/tmp/freesewing/node_modules/echarts/dist/echarts.js:25:2)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at mod.require (/tmp/freesewing/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:179:18)
    at Object.echarts (/tmp/freesewing/.next/server/pages/design/[design].js:1418:18)
    at __webpack_require__ (/tmp/freesewing/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./shared/components/wrappers/chart.mjs:6:65)
    at ./shared/components/wrappers/chart.mjs (/tmp/freesewing/.next/server/pages/design/[design].js:3475:1) {
  page: '/design/tutorial'
}

Could it be that the build step is attempting to compile on the server side a page that includes clientside-only code from echarts.js?

Happy to help debug this further.

Design / Plugin / Package 🧐

No response

Additional context

$ node -v
v21.7.0

Arch Linux.

@vladh vladh added the 🐛 bug Something isn't working label Apr 11, 2024
Copy link

boring-cyborg bot commented Apr 11, 2024

Thanks for opening your first issue here at FreeSewing 🥇
One of our contributors should triage this soon so that it gets some attention. If it's urgent, you can join us on Discord where we tend to hang out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant