Hi there,
I’m trying to deply a sveltekit website with Netlify but the build command fails everytime. I’ve seen a potential solution in the forum by changing npm run build to CI = npm run build in the netlify.toml but it doesn’t seem to work for me.
The build works fine in my local environment.
See below the build log
3:48:26 PM: Build ready to start
3:48:54 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)
3:48:54 PM: build-image tag: v4.5.3
3:48:54 PM: buildbot version: 7eafb394e33f42f945c880ce4ac17c149867813a
3:48:54 PM: Fetching cached dependencies
3:48:54 PM: Failed to fetch cache, continuing with build
3:48:54 PM: Starting to prepare the repo for build
3:48:55 PM: No cached dependencies found. Cloning fresh repo
3:48:55 PM: git clone https://github.com/monsieurho/skylandia-landing
3:48:56 PM: Preparing Git Reference refs/heads/main
3:48:57 PM: Parsing package.json dependencies
3:48:57 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'CI= npm run build' versus 'npm run build' in the Netlify UI
3:48:58 PM: Starting build script
3:48:58 PM: Installing dependencies
3:48:58 PM: Python version set to 2.7
3:48:58 PM: Downloading and installing node v16.14.0...
3:48:58 PM: Downloading https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz...
3:48:59 PM: Computing checksum with sha256sum
3:48:59 PM: Checksums matched!
3:49:01 PM: Now using node v16.14.0 (npm v8.3.1)
3:49:01 PM: Started restoring cached build plugins
3:49:01 PM: Finished restoring cached build plugins
3:49:02 PM: Attempting ruby version 2.7.2, read from environment
3:49:03 PM: Using ruby version 2.7.2
3:49:03 PM: Using PHP version 8.0
3:49:03 PM: Started restoring cached node modules
3:49:03 PM: Finished restoring cached node modules
3:49:03 PM: Installing NPM modules using NPM version 8.3.1
3:49:07 PM: added 163 packages, and audited 164 packages in 4s
3:49:07 PM: 20 packages are looking for funding
3:49:07 PM: run `npm fund` for details
3:49:07 PM: found 0 vulnerabilities
3:49:07 PM: NPM modules installed
3:49:08 PM: Started restoring cached go cache
3:49:08 PM: Finished restoring cached go cache
3:49:08 PM: go version go1.16.5 linux/amd64
3:49:08 PM: go version go1.16.5 linux/amd64
3:49:08 PM: Installing missing commands
3:49:08 PM: Verify run directory
3:49:09 PM:
3:49:09 PM: ────────────────────────────────────────────────────────────────
3:49:09 PM: Netlify Build
3:49:09 PM: ────────────────────────────────────────────────────────────────
3:49:09 PM:
3:49:09 PM: ❯ Version
3:49:09 PM: @netlify/build 26.4.0
3:49:09 PM:
3:49:09 PM: ❯ Flags
3:49:09 PM: baseRelDir: true
3:49:09 PM: buildId: 6229ad4915f9530009a278bf
3:49:09 PM: deployId: 6229ad4915f9530009a278c1
3:49:09 PM:
3:49:09 PM: ❯ Current directory
3:49:09 PM: /opt/build/repo
3:49:09 PM:
3:49:09 PM: ❯ Config file
3:49:09 PM: /opt/build/repo/netlify.toml
3:49:09 PM:
3:49:09 PM: ❯ Context
3:49:09 PM: production
3:49:09 PM:
3:49:09 PM: ────────────────────────────────────────────────────────────────
3:49:09 PM: 1. build.command from netlify.toml
3:49:09 PM: ────────────────────────────────────────────────────────────────
3:49:09 PM:
3:49:09 PM: $ CI= npm run build
3:49:09 PM: > skylandia-landing@0.0.1 build
3:49:09 PM: > svelte-kit build
3:49:10 PM: vite v2.8.4 building for production...
3:49:10 PM: transforming...
3:49:12 PM: ✓ 50 modules transformed.
3:49:12 PM: rendering chunks...
3:49:12 PM: .svelte-kit/output/client/_app/assets/close-50f4588c.png 6.12 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/map-lines-61b32ede.png 783.94 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/character-8f0ecbd5.png 386.00 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/backpack-78bb6ad8.png 649.21 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/lands-78f9655c.png 902.09 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/potion-defad364.png 1568.55 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/mutesound-8e107e02.png 8.20 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/playsound-da216efa.png 14.23 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-cyrillic-ext-400-normal-3df7909e.woff2 15.40 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-cyrillic-400-normal-c7d433fd.woff2 8.89 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-greek-ext-400-normal-9e2fe623.woff2 7.33 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-greek-400-normal-a8be01ce.woff2 10.27 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-latin-ext-400-normal-6bfabd30.woff2 11.10 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/NFThero-a7e4f933.jpg 526.75 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-latin-400-normal-e43b3538.woff2 15.90 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/headings-979617c4.woff 22.98 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/regulartext-480eee43.woff 15.49 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/map-bf878052.jpg 3660.50 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/fira-mono-all-400-normal-1e3b098c.woff 75.55 KiB
3:49:12 PM: .svelte-kit/output/client/_app/manifest.json 3.69 KiB
3:49:12 PM: .svelte-kit/output/client/_app/error.svelte-92eb272b.js 1.56 KiB / gzip: 0.75 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/index.svelte-0c669203.js 3.27 KiB / gzip: 1.37 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/Contact.svelte-56648cf0.js 3.09 KiB / gzip: 1.27 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/about.svelte-81877502.js 9.65 KiB / gzip: 3.14 KiB
3:49:12 PM: .svelte-kit/output/client/_app/start-ae37f40b.js 24.65 KiB / gzip: 8.35 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/todos/index.svelte-55939588.js 5.91 KiB / gzip: 2.40 KiB
3:49:12 PM: .svelte-kit/output/client/_app/chunks/singletons-a6a7384f.js 0.05 KiB / gzip: 0.07 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/NFTs.svelte-7101542b.js 10.96 KiB / gzip: 3.29 KiB
3:49:12 PM: .svelte-kit/output/client/_app/chunks/vendor-93a2d797.js 14.30 KiB / gzip: 5.97 KiB
3:49:12 PM: .svelte-kit/output/client/_app/chunks/close-c8e3edd7.js 0.05 KiB / gzip: 0.07 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/Contact.svelte-97564dfb.css 0.22 KiB / gzip: 0.15 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/about.svelte-ad5ae19a.css 2.38 KiB / gzip: 0.70 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/index.svelte-6ef62646.css 2.41 KiB / gzip: 0.70 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/todos/index.svelte-784042c1.css 3.70 KiB / gzip: 1.04 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/NFTs.svelte-bddfa654.css 1.65 KiB / gzip: 0.55 KiB
3:49:12 PM: .svelte-kit/output/client/_app/assets/pages/__layout.svelte-ff9b8276.css 13.74 KiB / gzip: 3.23 KiB
3:49:12 PM: .svelte-kit/output/client/_app/pages/__layout.svelte-8b6c68fc.js 119.24 KiB / gzip: 40.49 KiB
3:49:12 PM: vite v2.8.4 building SSR bundle for production...
3:49:12 PM: transforming...
3:49:13 PM: ✓ 53 modules transformed.
3:49:13 PM: rendering chunks...
3:49:13 PM: .svelte-kit/output/server/manifest.json 3.37 KiB
3:49:13 PM: .svelte-kit/output/server/index.js 64.71 KiB
3:49:13 PM: .svelte-kit/output/server/entries/endpoints/contact.json.js 0.72 KiB
3:49:13 PM: .svelte-kit/output/server/entries/endpoints/todos/index.js 1.33 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/__layout.svelte.js 65.67 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/error.svelte.js 0.72 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/index.svelte.js 3.13 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/Contact.svelte.js 1.14 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/about.svelte.js 6.93 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/todos/index.svelte.js 5.84 KiB
3:49:13 PM: .svelte-kit/output/server/entries/pages/NFTs.svelte.js 5.32 KiB
3:49:13 PM: .svelte-kit/output/server/chunks/index-dca6450b.js 3.42 KiB
3:49:13 PM: .svelte-kit/output/server/chunks/close-c8e3edd7.js 0.08 KiB
3:49:13 PM: Run npm run preview to preview your production build locally.
3:49:13 PM:
3:49:13 PM: > Using @sveltejs/adapter-netlify
3:49:14 PM: > builder.writePrerendered is not a function
3:49:14 PM: at adapt (file:///opt/build/repo/node_modules/@sveltejs/adapter-netlify/index.js:125:12)
3:49:14 PM: at adapt (file:///opt/build/repo/node_modules/@sveltejs/kit/dist/chunks/index5.js:876:8)
3:49:14 PM: at file:///opt/build/repo/node_modules/@sveltejs/kit/dist/cli.js:1062:11
3:49:14 PM:
3:49:14 PM: ────────────────────────────────────────────────────────────────
3:49:14 PM: "build.command" failed
3:49:14 PM: ────────────────────────────────────────────────────────────────
3:49:14 PM:
3:49:14 PM: Error message
3:49:14 PM: Command failed with exit code 1: CI= npm run build
3:49:14 PM:
3:49:14 PM: Error location
3:49:14 PM: In build.command from netlify.toml:
3:49:14 PM: CI= npm run build
3:49:14 PM:
3:49:14 PM: Resolved config
3:49:14 PM: build:
3:49:14 PM: command: CI= npm run build
3:49:14 PM: commandOrigin: config
3:49:15 PM: Creating deploy upload records
3:49:14 PM: publish: /opt/build/repo/build
3:49:14 PM: publishOrigin: config
3:49:14 PM: Caching artifacts
3:49:14 PM: Started saving node modules
3:49:14 PM: Finished saving node modules
3:49:16 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:49:14 PM: Started saving build plugins
3:49:14 PM: Finished saving build plugins
3:49:14 PM: Started saving pip cache
3:49:14 PM: Finished saving pip cache
3:49:14 PM: Started saving emacs cask dependencies
3:49:14 PM: Finished saving emacs cask dependencies
3:49:14 PM: Started saving maven dependencies
3:49:14 PM: Finished saving maven dependencies
3:49:14 PM: Started saving boot dependencies
3:49:14 PM: Finished saving boot dependencies
3:49:14 PM: Started saving rust rustup cache
3:49:14 PM: Finished saving rust rustup cache
3:49:14 PM: Started saving go dependencies
3:49:14 PM: Finished saving go dependencies
3:49:15 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:49:16 PM: Failing build: Failed to build site
3:49:16 PM: Finished processing build request in 21.703075163s
Thanks in advance for your help!
Gregory