OutOfMemory when building
I keep running out of memory when trying to build the project:
Singularity> npm ci
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @melt-ui/[email protected]
npm warn Found: [email protected]
npm warn node_modules/svelte
npm warn dev svelte@"^5.19.3" from the root project
npm warn 10 more (@sveltejs/kit, @sveltejs/vite-plugin-svelte, ...)
npm warn
npm warn Could not resolve dependency:
npm warn peer svelte@">=3 <5" from @melt-ui/[email protected]
npm warn node_modules/bits-ui/node_modules/@melt-ui/svelte
npm warn @melt-ui/svelte@"0.76.2" from [email protected]
npm warn node_modules/bits-ui
npm warn
npm warn Conflicting peer dependency: [email protected]
npm warn node_modules/svelte
npm warn peer svelte@">=3 <5" from @melt-ui/[email protected]
npm warn node_modules/bits-ui/node_modules/@melt-ui/svelte
npm warn @melt-ui/svelte@"0.76.2" from [email protected]
npm warn node_modules/bits-ui
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Renamed to read-package-up
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Use your platform's native DOMException instead
added 1055 packages, and audited 1271 packages in 1m
235 packages are looking for funding
run `npm fund` for details
7 vulnerabilities (5 low, 2 moderate)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Singularity> npm run build
> [email protected] build
> svelte-kit sync && vite build
node:internal/process/promises:391
triggerUncaughtException(err, true /* fromPromise */);
^
[RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance]
Node.js v20.19.4
That's strange, did you check that the device you are trying to build on isn't starved for memory? I also see you are using Node v20.x, we run our builds on v22.x. Can you try upgrading it?
If none of that works, can you run this command and copy/paste the output?
npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers
olalaw@base:hollama$ npm ci
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @melt-ui/[email protected]
npm warn Found: [email protected]
npm warn node_modules/svelte
npm warn dev svelte@"^5.19.3" from the root project
npm warn 10 more (@sveltejs/kit, @sveltejs/vite-plugin-svelte, ...)
npm warn
npm warn Could not resolve dependency:
npm warn peer svelte@">=3 <5" from @melt-ui/[email protected]
npm warn node_modules/bits-ui/node_modules/@melt-ui/svelte
npm warn @melt-ui/svelte@"0.76.2" from [email protected]
npm warn node_modules/bits-ui
npm warn
npm warn Conflicting peer dependency: [email protected]
npm warn node_modules/svelte
npm warn peer svelte@">=3 <5" from @melt-ui/[email protected]
npm warn node_modules/bits-ui/node_modules/@melt-ui/svelte
npm warn @melt-ui/svelte@"0.76.2" from [email protected]
npm warn node_modules/bits-ui
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Renamed to read-package-up
npm warn deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Use your platform's native DOMException instead
added 1055 packages, and audited 1271 packages in 2m
235 packages are looking for funding
run `npm fund` for details
9 vulnerabilities (5 low, 2 moderate, 2 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 10.9.0 -> 11.4.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.4.2
npm notice To update run: npm install -g [email protected]
npm notice
olalaw@base:hollama$ npm run build
> [email protected] build
> svelte-kit sync && vite build
/gpfs/mariana/home/olalaw/code/hollama/node_modules/wrangler/wrangler-dist/cli.js:7046
return await WebAssembly.instantiate(mod, {
^
RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance
at lazyllhttp (/gpfs/mariana/home/olalaw/code/hollama/node_modules/wrangler/wrangler-dist/cli.js:7046:32)
Node.js v22.12.0
olalaw@base:hollama$ npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
System:
OS: Linux 4.18 Rocky Linux 8.10 (Green Obsidian)
CPU: (16) x64 Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
Memory: 43.24 GB / 78.14 GB
Container: Yes
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 22.12.0 - ~/software/node-v22.12.0-linux-x64/bin/node
npm: 10.9.2 - ~/code/hollama/node_modules/.bin/npm
npmPackages:
svelte: ^5.19.3 => 5.28.2
I got the build working on a seperate system but then I encountered another issue while previewing whenever I open up the page:
npm run preview
> [email protected] preview
> vite preview
➜ Local: http://localhost:4173/
➜ Network: http://192.168.0.16:4173/
➜ press h + enter to show help
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:159:15)
at writeGeneric (node:internal/stream_base_commons:150:3)
at Socket._writeGeneric (node:net:971:11)
at Socket._write (node:net:983:8)
at writeOrBuffer (node:internal/streams/writable:572:12)
at _write (node:internal/streams/writable:501:10)
at Writable.write (node:internal/streams/writable:510:10)
at Runtime.updateConfig (/home/olalaw/src/hollama/node_modules/miniflare/dist/src/index.js:10307:26)
at async #assembleAndUpdateConfig (/home/olalaw/src/hollama/node_modules/miniflare/dist/src/index.js:15981:30)
at async Mutex.runWith (/home/olalaw/src/hollama/node_modules/miniflare/dist/src/index.js:1664:48) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Node.js v22.16.0
Tried with Firefox and Vivaldi, same result.
envinfo:
npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
System:
OS: Linux 6.12 cpe:/o:nixos:nixos:25.05 25.05 (Warbler)
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Memory: 11.18 GB / 15.40 GB
Container: Yes
Shell: 5.2.37 - /run/current-system/sw/bin/bash
Binaries:
Node: 22.16.0 - /etc/profiles/per-user/olalaw/bin/node
npm: 10.9.2 - ~/src/hollama/node_modules/.bin/npm
npmPackages:
svelte: ^5.19.3 => 5.28.2
Based on this SO thread it looks like this error is caused by a missing C++ runtime library on Linux running Miniflare with the Cloudflare adapter. Can you try installing the libc++1 package and see if that fixes it?
That didn't fix it but I'll say its probably a nixos issue, maybe. That said, is there a way do disable the cloudfare sdk dependency running at all? I don't need it and it seems to be causing both the OOM and EPIPE issue.
Also the Dockerfile uses node:20-alpine which is why I assumed node 20.x would be fine, might want to update that.
Also the Dockerfile uses node:20-alpine which is why I assumed node 20.x would be fine, might want to update that.
Ah, good point. I think the app builds correctly in Node v20, it's just that we typically develop on v22 (also the version Cloudflare wants) and we only set it in .nvmrc.
One thing I forgot to mention is that you can run a non-Cloudflare build which might work without any additional dependencies, give it a shot:
PUBLIC_ADAPTER="docker-node" npm run build && npm run preview
Pulled the latest commit just to make sure but nope, same issue:
$ PUBLIC_ADAPTER="docker-node" npm run build && npm run preview
> [email protected] build
> svelte-kit sync && vite build
/gpfs/mariana/home/olalaw/code/hollama/node_modules/wrangler/wrangler-dist/cli.js:7046
return await WebAssembly.instantiate(mod, {
^
RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance
at lazyllhttp (/gpfs/mariana/home/olalaw/code/hollama/node_modules/wrangler/wrangler-dist/cli.js:7046:32)
Node.js v22.12.0