I’m trying to package a vuepress project. I’ve successfully packaged other web projects before. But with vuepress, though I don’t get any errors the build is extremely slow or hangs (not finished within 20 mins through nix build even though a manual npm run docs:build takes less than 10 secs).
I have been unable to look into the process to figure out what’s happening. Either that’s not possible, or I lack knowledge of adequate tools.
I created an MWE and would be super glad if somebody could help me out!
Great that you figured it out for your usecase! Unfortunately, when I try this, it does not hang, but errors. I’m able to inspect the error by redirecting it to a tmp file instead and using
nix build --keep-failed
ls -d /tmp/nix-build-* | tail -n 1
# cd into build directory and read `tmp` file
It is
> nixxer-docs@0.0.1 docs:build
> vuepress-vite build src
- Initializing and preparing data
✔ Initializing and preparing data - done in 4.75s
- Compiling with vite
node:events:497
throw er; // Unhandled 'error' event
^
Error: spawn /build/docs/node_modules/sass-embedded-linux-x64/dart-sass/src/dart ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /build/docs/node_modules/sass-embedded-linux-x64/dart-sass/src/dart',
path: '/build/docs/node_modules/sass-embedded-linux-x64/dart-sass/src/dart',
spawnargs: [
'/build/docs/node_modules/sass-embedded-linux-x64/dart-sass/src/sass.snapshot',
'--embedded'
]
}
Node.js v20.17.0
I can’t say I really understand it.
However, this lead me to discover this issue in the sass-embedded project, which explains the problem a bit and suggests some solutions (which either are unreliable or didn’t work for me).
However, that issue suggests that it is a simple nixos-and-pre-built-binaries thing. However, if it was, I don’t see how it’s possible that build works outside of a nix build using npm run docs:build. Very curious