Debugging advice when trying to deploy sveltekit to netlify: Cannot find module './llhttp/llhttp_simd.wasm.js' from '/opt/build/repo/.netlify'

Site name: mevorach

When I try to deploy my new sveltekit project to netlify, I get this error message:

8:06:56 PM:   Error message
8:06:56 PM:   A Netlify Function failed to require one of its dependencies.
8:06:56 PM:   Please make sure it is present in the site's top-level "package.json".
​
8:06:56 PM:   In file "/opt/build/repo/.netlify/functions-internal/render.js"
8:06:56 PM:   Cannot find module './llhttp/llhttp_simd.wasm.js' from '/opt/build/repo/.netlify'

Not sure why this is happening, I’ve also tried doing locally β€œnetlify build” and I receive the same error log.

What’s happening? it looks like a bug.
Another person reported this.

Full build log:

8:06:12 PM: Build ready to start
8:06:14 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
8:06:14 PM: build-image tag: focal
8:06:14 PM: buildbot version: 8dba8e08e1359f22ae92654e177dea552324c91c
8:06:14 PM: Fetching cached dependencies
8:06:14 PM: Failed to fetch cache, continuing with build
8:06:14 PM: Starting to prepare the repo for build
8:06:14 PM: No cached dependencies found. Cloning fresh repo
8:06:14 PM: git clone https://github.com/elron/mevorach
8:06:16 PM: Preparing Git Reference refs/heads/master
8:06:17 PM: Parsing package.json dependencies
8:06:18 PM: Starting build script
8:06:18 PM: Installing dependencies
8:06:18 PM: Python version set to 2.7
8:06:19 PM: v16.15.1 is already installed.
8:06:19 PM: Now using node v16.15.1 (npm v8.11.0)
8:06:19 PM: Started restoring cached build plugins
8:06:19 PM: Finished restoring cached build plugins
8:06:19 PM: Attempting ruby version 2.7.2, read from environment
8:06:20 PM: Using ruby version 2.7.2
8:06:21 PM: Using PHP version 8.0
8:06:21 PM: No npm workspaces detected
8:06:21 PM: Started restoring cached node modules
8:06:21 PM: Finished restoring cached node modules
8:06:21 PM: Installing NPM modules using NPM version 8.11.0
8:06:22 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
8:06:22 PM: npm WARN config location in the cache, and they are managed by
8:06:22 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
8:06:22 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
8:06:22 PM: npm WARN config location in the cache, and they are managed by
8:06:22 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
8:06:27 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
8:06:42 PM: > code@0.0.1 prepare
8:06:42 PM: > svelte-kit sync
8:06:43 PM: added 345 packages, and audited 365 packages in 21s
8:06:43 PM: 40 packages are looking for funding
8:06:43 PM:   run `npm fund` for details
8:06:43 PM: 3 high severity vulnerabilities
8:06:43 PM: To address all issues (including breaking changes), run:
8:06:43 PM:   npm audit fix --force
8:06:43 PM: Run `npm audit` for details.
8:06:43 PM: NPM modules installed
8:06:43 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
8:06:43 PM: npm WARN config location in the cache, and they are managed by
8:06:43 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
8:06:43 PM: Started restoring cached go cache
8:06:43 PM: Finished restoring cached go cache
8:06:43 PM: Installing Go version 1.17 (requested 1.17)
8:06:50 PM: unset GOOS;
8:06:50 PM: unset GOARCH;
8:06:50 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
8:06:50 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
8:06:50 PM: go version >&2;
8:06:50 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
8:06:50 PM: go version go1.17 linux/amd64
8:06:50 PM: Installing missing commands
8:06:50 PM: Verify run directory
8:06:51 PM: ​
8:06:51 PM: ────────────────────────────────────────────────────────────────
8:06:51 PM:   Netlify Build                                                 
8:06:51 PM: ────────────────────────────────────────────────────────────────
8:06:51 PM: ​
8:06:51 PM: ❯ Version
8:06:51 PM:   @netlify/build 27.3.1
8:06:51 PM: ​
8:06:51 PM: ❯ Flags
8:06:51 PM:   baseRelDir: true
8:06:51 PM:   buildId: 62bf2984347d80000873b589
8:06:51 PM:   deployId: 62bf2984347d80000873b58b
8:06:51 PM: ​
8:06:51 PM: ❯ Current directory
8:06:51 PM:   /opt/build/repo
8:06:51 PM: ​
8:06:51 PM: ❯ Config file
8:06:51 PM:   /opt/build/repo/netlify.toml
8:06:51 PM: ​
8:06:51 PM: ❯ Context
8:06:51 PM:   production
8:06:51 PM: ​
8:06:51 PM: ────────────────────────────────────────────────────────────────
8:06:51 PM:   1. Build command from Netlify app                             
8:06:51 PM: ────────────────────────────────────────────────────────────────
8:06:51 PM: ​
8:06:51 PM: $ npm run build
8:06:51 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
8:06:51 PM: npm WARN config location in the cache, and they are managed by
8:06:51 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
8:06:51 PM: > code@0.0.1 build
8:06:51 PM: > svelte-kit build
8:06:52 PM: vite v2.9.13 building for production...
8:06:52 PM: transforming...
8:06:54 PM: 5:06:54 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/screens/ErrorScreen.svelte:65:0 Unused CSS selector ".main-button"
8:06:54 PM: 63: }
8:06:54 PM: 64:
8:06:54 PM: 65: .main-button {
8:06:54 PM:     ^
8:06:54 PM: 66:   height: auto;
8:06:54 PM: 67:   display: inline-block;
8:06:54 PM: 5:06:54 PM [vite-plugin-svelte] /opt/build/repo/src/lib/backstage/Debugger.svelte:51:0 Unused CSS selector ".md"
8:06:54 PM: 49: }
8:06:54 PM: 50:
8:06:54 PM: 51: .md {
8:06:54 PM:     ^
8:06:54 PM: 52:   position: absolute;
8:06:54 PM: 53:   top: 0;
8:06:54 PM: 5:06:54 PM [vite-plugin-svelte] /opt/build/repo/src/lib/backstage/Debugger.svelte:61:0 Unused CSS selector ".md .bg"
8:06:54 PM: 59:   z-index: 100000000000000000000000000000000000000000000000000000;
8:06:54 PM: 60: }
8:06:54 PM: 61: .md .bg {
8:06:54 PM:     ^
8:06:54 PM: 62:   width: 30vh;
8:06:54 PM: 63:   height: 30vh;
8:06:54 PM: 5:06:54 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/create/Preview.svelte:33:8 Empty block
8:06:54 PM: 31:   <p class="line" data-index={index}>
8:06:54 PM: 32:     <span class="the-line">{line}</span>
8:06:54 PM: 33:         {#if index }
8:06:54 PM:             ^
8:06:54 PM: 34:
8:06:54 PM: 35:         {/if}
8:06:54 PM: 5:06:54 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/homepage/Gallery.svelte:2:4 A11y: <img> element should have an alt attribute
8:06:54 PM: 1: <div class="bg">
8:06:54 PM: 2:     <img src="/images/examples/bg.png"/>
8:06:54 PM:        ^
8:06:54 PM: 3: </div>
8:06:54 PM: 4:
8:06:54 PM: βœ“ 52 modules transformed.
8:06:54 PM: rendering chunks...
8:06:54 PM:   Client build completed. Wrote 9 chunks and 5 assets
8:06:54 PM:   Building server
8:06:54 PM: .svelte-kit/output/client/_app/immutable/manifest.json                               2.20 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/pages/__error.svelte-d3d393c9.js            4.96 KiB / gzip: 1.64 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/pages/__layout.svelte-19c4e84d.js           12.66 KiB / gzip: 4.67 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/pages/create.svelte-4350f9a0.js             3.68 KiB / gzip: 1.63 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/start-3c33159f.js                           23.28 KiB / gzip: 8.73 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/pages/index.svelte-1516f4f2.js              4.45 KiB / gzip: 1.27 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/chunks/singletons-f8c07ef7.js               0.83 KiB / gzip: 0.51 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/chunks/createStore-28b37a1b.js              0.80 KiB / gzip: 0.43 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/chunks/index-377ef2d5.js                    0.93 KiB / gzip: 0.42 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/assets/pages/__error.svelte-e0756e15.css    0.88 KiB / gzip: 0.35 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/chunks/index-b2f82e5e.js                    10.30 KiB / gzip: 4.31 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/assets/pages/create.svelte-1abb7d20.css     0.38 KiB / gzip: 0.20 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/assets/pages/index.svelte-ea4fa9c6.css      1.16 KiB / gzip: 0.52 KiB
8:06:54 PM: .svelte-kit/output/client/_app/immutable/assets/pages/__layout.svelte-7cea3cf6.css   41.96 KiB / gzip: 29.39 KiB
8:06:54 PM: vite v2.9.13 building SSR bundle for production...
8:06:55 PM: transforming...
8:06:55 PM: 5:06:55 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/create/Preview.svelte:33:8 Empty block
8:06:55 PM: 31:   <p class="line" data-index={index}>
8:06:55 PM: 32:     <span class="the-line">{line}</span>
8:06:55 PM: 33:         {#if index }
8:06:55 PM:             ^
8:06:55 PM: 34:
8:06:55 PM: 35:         {/if}
8:06:55 PM: 5:06:55 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/screens/ErrorScreen.svelte:65:0 Unused CSS selector ".main-button"
8:06:55 PM: 63: }
8:06:55 PM: 64:
8:06:55 PM: 65: .main-button {
8:06:55 PM:     ^
8:06:55 PM: 66:   height: auto;
8:06:55 PM: 67:   display: inline-block;
8:06:55 PM: 5:06:55 PM [vite-plugin-svelte] /opt/build/repo/src/lib/backstage/Debugger.svelte:51:0 Unused CSS selector ".md"
8:06:55 PM: 49: }
8:06:55 PM: 50:
8:06:55 PM: 51: .md {
8:06:55 PM:     ^
8:06:55 PM: 52:   position: absolute;
8:06:55 PM: 53:   top: 0;
8:06:55 PM: 5:06:55 PM [vite-plugin-svelte] /opt/build/repo/src/lib/backstage/Debugger.svelte:61:0 Unused CSS selector ".md .bg"
8:06:55 PM: 59:   z-index: 100000000000000000000000000000000000000000000000000000;
8:06:55 PM: 60: }
8:06:55 PM: 61: .md .bg {
8:06:55 PM:     ^
8:06:55 PM: 62:   width: 30vh;
8:06:55 PM: 63:   height: 30vh;
8:06:55 PM: 5:06:55 PM [vite-plugin-svelte] /opt/build/repo/src/lib/components/homepage/Gallery.svelte:2:4 A11y: <img> element should have an alt attribute
8:06:55 PM: 1: <div class="bg">
8:06:55 PM: 2:     <img src="/images/examples/bg.png"/>
8:06:55 PM:        ^
8:06:55 PM: 3: </div>
8:06:55 PM: 4:
8:06:55 PM: βœ“ 53 modules transformed.
8:06:55 PM: Generated an empty chunk: "entries/endpoints/bank.json.ts"
8:06:55 PM: Generated an empty chunk: "hooks"
8:06:55 PM: rendering chunks...
8:06:55 PM: .svelte-kit/output/server/manifest.json                          2.12 KiB
8:06:55 PM: .svelte-kit/output/server/index.js                               73.00 KiB
8:06:55 PM: .svelte-kit/output/server/entries/endpoints/bank.json.ts.js      0.00 KiB
8:06:55 PM: .svelte-kit/output/server/entries/endpoints/_id_integer_.ts.js   0.16 KiB
8:06:55 PM: .svelte-kit/output/server/entries/pages/__layout.svelte.js       92.20 KiB
8:06:55 PM: .svelte-kit/output/server/entries/pages/__error.svelte.js        4.80 KiB
8:06:55 PM: .svelte-kit/output/server/entries/pages/create.svelte.js         3.19 KiB
8:06:55 PM: .svelte-kit/output/server/entries/pages/index.svelte.js          4.89 KiB
8:06:55 PM: .svelte-kit/output/server/entries/matchers/integer.js            0.07 KiB
8:06:55 PM: .svelte-kit/output/server/chunks/index-bf8b4a78.js               3.59 KiB
8:06:55 PM: .svelte-kit/output/server/chunks/createStore-9d231c4a.js         4.14 KiB
8:06:55 PM: .svelte-kit/output/server/chunks/hooks-1c45ba0b.js               0.00 KiB
8:06:55 PM:   Prerendering
8:06:55 PM: Production Mode
8:06:55 PM: (node:1384) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
8:06:55 PM: (Use `node --trace-warnings ...` to show where the warning was created)
8:06:55 PM: Run npm run preview to preview your production build locally.
8:06:55 PM: 
8:06:55 PM: > Using @sveltejs/adapter-netlify
8:06:55 PM:   No publish directory specified in netlify.toml, using default
8:06:55 PM:   Publishing to "build"
8:06:55 PM:   Copying assets...
8:06:55 PM:   Writing custom headers...
8:06:56 PM:   Generating serverless functions...
8:06:56 PM:   Writing redirects...
8:06:56 PM:   βœ” done
8:06:56 PM: ​
8:06:56 PM: (build.command completed in 4.4s)
8:06:56 PM: ​
8:06:56 PM: ────────────────────────────────────────────────────────────────
8:06:56 PM:   2. Functions bundling                                         
8:06:56 PM: ────────────────────────────────────────────────────────────────
8:06:56 PM: ​
8:06:56 PM: Packaging Functions from .netlify/functions-internal directory:
8:06:56 PM:  - render.js
8:06:56 PM: ​
8:06:56 PM: ​
8:06:56 PM: ────────────────────────────────────────────────────────────────
8:06:56 PM:   Dependencies installation error                               
8:06:56 PM: ────────────────────────────────────────────────────────────────
8:06:56 PM: ​
8:06:56 PM:   Error message
8:06:56 PM:   A Netlify Function failed to require one of its dependencies.
8:06:56 PM:   Please make sure it is present in the site's top-level "package.json".​
8:06:56 PM:   In file "/opt/build/repo/.netlify/functions-internal/render.js"
8:06:56 PM:   Cannot find module './llhttp/llhttp_simd.wasm.js' from '/opt/build/repo/.netlify'
8:06:56 PM: ​
8:06:56 PM:   Resolved config
8:06:56 PM:   build:
8:06:56 PM:     command: npm run build
8:06:56 PM:     commandOrigin: ui
8:06:56 PM:     environment:
8:06:56 PM:       - VITE_AWS_ACCESS_KEY_ID
8:06:56 PM:       - VITE_AWS_BUCKET_NAME
8:06:56 PM:       - VITE_AWS_SECRET_ACCESS_KEY
8:06:56 PM:       - VITE_GOOGLE_SPREADSHEETS_PRIVATE_NEEGZAR_API_KEY
8:06:56 PM:       - VITE_MONGO_DB_URI
8:06:56 PM:     publish: /opt/build/repo/build
8:06:56 PM:     publishOrigin: ui
8:06:56 PM:   headers:
8:06:57 PM:     - for: /_app/immutable/*      values:        cache-control: public, immutable, max-age=31536000  redirects:    - from: /api/*      status: 200      to: /.netlify/functions/:splat    - from: '*'      status: 200      to: /.netlify/functions/renderCaching artifacts
8:06:57 PM: Started saving node modules
8:06:57 PM: Finished saving node modules
8:06:57 PM: Started saving build plugins
8:06:57 PM: Finished saving build plugins
8:06:57 PM: Started saving pip cache
8:06:57 PM: Finished saving pip cache
8:06:57 PM: Started saving emacs cask dependencies
8:06:57 PM: Finished saving emacs cask dependencies
8:06:57 PM: Started saving maven dependencies
8:06:57 PM: Finished saving maven dependencies
8:06:57 PM: Started saving boot dependencies
8:06:57 PM: Finished saving boot dependencies
8:06:57 PM: Started saving rust rustup cache
8:06:57 PM: Finished saving rust rustup cache
8:06:57 PM: Started saving go dependencies
8:06:57 PM: Finished saving go dependencies
8:06:58 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:06:58 PM: Creating deploy upload records
8:06:58 PM: Failing build: Failed to build site
8:06:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:06:58 PM: Finished processing build request in 44.7774601s
1 Like

Hi @elron,

As discussed in the helpdesk, this appears to be something with Svelte than Netlify. For others who come here, here is where it’s being discussed: