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

failed to exec "npm run compile" in windows 10 #97

Open
XUANYUANRuins opened this issue Dec 5, 2024 · 2 comments
Open

failed to exec "npm run compile" in windows 10 #97

XUANYUANRuins opened this issue Dec 5, 2024 · 2 comments

Comments

@XUANYUANRuins
Copy link

Question

when i run the command "npm run compile" ,it has some error like :

  • info Collecting page data .deleteTmpSessionChart
  • info Collecting page data ...Error [ERR_REQUIRE_ESM]: require() of ES Module E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules@antv\g-lite\node_modules\d3-color\src\index.js from E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules@antv\g-lite\dist\index.js not supported.
    Instead change the require of E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules@antv\g-lite\node_modules\d3-color\src\index.js in E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules@antv\g-lite\dist\index.js to a dynamic import() which is available in all CommonJS modules.
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at Object. (E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules@antv\g-lite\dist\index.js:7:10) {
    code: 'ERR_REQUIRE_ESM'
    }

Build error occurred
Error: Failed to collect page data for /knowledge/graph
at E:\IdeaWorkspace\AIGC\db-gpt-web\node_modules\next\dist\build\utils.js:1161:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'

NodeJs -> V 22.4.1
Npm -> V10.8.1

@gaogaomie
Copy link

Brother, I have the same problem as you, have you solved it?

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules- info Linting

  • info Collecting page data ..Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\gaogao\Desktop\DB-GPT\web\node_modules\d3-color\src\index.js from C:\Users\gaogao\Desktop\DB-GPT\web\node_modules@antv\g-lite\dist\index.js not supported.Instead change the require of C:\Users\gaogao\Desktop\DB-GPT\web\node_modules\d3-color\src\index.js in C:\Users\gaogao\Desktop\DB-GPT\web\node_modules@antv\g-lite\dist\index.js to a dynamic import() which is available in all CommonJS modules.
    at Object. (C:\Users\gaogao\Desktop\DB-GPT\web\node_modules@antv\g-lite\dist\index.js:24:10) {
    code: 'ERR_REQUIRE_ESM'
    }

Build error occurred
Error: Failed to collect page data for /knowledge/graph
at C:\Users\gaogao\Desktop\DB-GPT\web\node_modules\next\dist\build\utils.js:1161:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}

  • info Collecting page data .Note: This command was run via npm module 'win-node-env'

@gaogaomie
Copy link

Brother, I have solved this problem. Please see if my solution can help you.

  1. Use yarn install to install dependent packages, do not use npm
  2. The Windows-style line break is CRLF, which is a combination of carriage return and line feed. In the project, Prettier expects the Unix-style line break to be LF, which is only line feed, so you need to run npm run format
  3. Run yarn compile
  4. The most important thing is that the front-end project has prettier verification. There will be errors during compilation. Use the logs to modify the areas that do not meet the specifications.

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

2 participants