evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
3.38k stars 163 forks source link

npm run build failed #1933

Closed morindo closed 2 weeks ago

morindo commented 2 weeks ago

Steps To Reproduce

Just follow the Install Evidence tutorial.

npx degit evidence-dev/template my-project
cd my-project
npm install
npm run sources
npm run build

Environment

package.json

{
  "name": "my-evidence-project",
  "version": "0.0.1",
  "scripts": {
    "build": "evidence build",
    "build:strict": "evidence build:strict",
    "dev": "evidence dev --open /",
    "test": "evidence build",
    "sources": "evidence sources",
    "preview": "evidence preview"
  },
  "engines": {
    "npm": ">=7.0.0",
    "node": ">=18.0.0"
  },
  "type": "module",
  "dependencies": {
    "@evidence-dev/bigquery": "^2.0.5",
    "@evidence-dev/core-components": "^4.0.1",
    "@evidence-dev/csv": "^1.0.8",
    "@evidence-dev/databricks": "^1.0.5",
    "@evidence-dev/duckdb": "^1.0.8",
    "@evidence-dev/evidence": "^33.0.1",
    "@evidence-dev/mssql": "^1.0.6",
    "@evidence-dev/mysql": "^1.1.1",
    "@evidence-dev/postgres": "^1.0.5",
    "@evidence-dev/snowflake": "^1.0.4",
    "@evidence-dev/sqlite": "^2.0.4",
    "@evidence-dev/trino": "^1.0.5"
  },
  "overrides": {
    "jsonwebtoken": "9.0.0",
    "trim@<0.0.3": ">0.0.3",
    "sqlite3": "5.1.5"
  }
}

Expected Behavior

The npm run build should complete without error.

Actual Behaviour

I get a build error at the end.

node:internal/event_target:1006
  process.nextTick(() => { throw err; });
                           ^
Error: Failed to get response header "content-length" — it must be included by the `filterSerializedResponseHeaders` option: https://kit.svelte.dev/docs/hooks#server-hooks-handle (at /)
    at response.headers.get (file:///C:/Users/Dominic/Dev/Sandbox/evidence_wsl/my-project/.evidence/template/.svelte-kit/output/server/index.js:657:19)
    at Response.arrayBuffer (node:internal/deps/undici/undici:6108:46)
    at visit (file:///C:/Users/Dominic/Dev/Sandbox/evidence_wsl/my-project/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:258:69)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:290:10)
    at [kOnMessage] (node:internal/worker:301:37)
    at MessagePort.<anonymous> (node:internal/worker:202:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:731:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v18.12.1
Build failed

file:///C:/Users/Dominic/Dev/Sandbox/evidence_wsl/my-project/node_modules/@evidence-dev/evidence/cli.js:178
                        throw `Build process exited with code ${code}`;
                        ^
Build process exited with code 1
(Use `node --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.12.1

Workarounds

There is no workaround I can find at the moment.

csjh commented 2 weeks ago

Hi Dominic! Thanks for the report - I'm having trouble reproducing on my machines. Are there any major distinguishing features in your environment that you can think of (i.e. using WSL w/ a specific distribution, running in codespaces)?

morindo commented 2 weeks ago

Hi Dominic! Thanks for the report - I'm having trouble reproducing on my machines. Are there any major distinguishing features in your environment that you can think of (i.e. using WSL w/ a specific distribution, running in codespaces)?

Thank you for the follow-up. Yes, I have WSL installed. Btw, I also tried to replicate the problem inside WSL, same end result.

I just asked a colleague and he does not have the problem. I'll investigate the problem on my machine and get back to you.

morindo commented 2 weeks ago

Okay, I just installed the latest 18.20.2 LTS version of Node and npm run build on my evidence project is working. I guess it was related with my old node version (v18.12.1 LTS). Found a link about a similar problem with SvelteKit.

https://github.com/nextauthjs/next-auth/issues/9809

Thanks again @csjh