Command failed with exit code 1: npm run build

10:20:08 AM: Build ready to start
10:20:15 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
10:20:15 AM: build-image tag: v4.8.0
10:20:15 AM: buildbot version: 4aaa27647e859c2d38cfbb25901ceae1e7f3eeae
10:20:15 AM: Fetching cached dependencies
10:20:15 AM: Failed to fetch cache, continuing with build
10:20:15 AM: Starting to prepare the repo for build
10:20:15 AM: No cached dependencies found. Cloning fresh repo
10:20:15 AM: git clone https://github.com/henilpatel05/Portfolio
10:20:16 AM: Preparing Git Reference refs/heads/main
10:20:16 AM: Parsing package.json dependencies
10:20:17 AM: Starting build script
10:20:17 AM: Installing dependencies
10:20:17 AM: Python version set to 2.7
10:20:18 AM: Downloading and installing node v16.15.1…
10:20:18 AM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz
10:20:18 AM: Computing checksum with sha256sum
10:20:19 AM: Checksums matched!
10:20:21 AM: Now using node v16.15.1 (npm v8.11.0)
10:20:21 AM: Started restoring cached build plugins
10:20:21 AM: Finished restoring cached build plugins
10:20:21 AM: Attempting ruby version 2.7.2, read from environment
10:20:22 AM: Using ruby version 2.7.2
10:20:22 AM: Using PHP version 8.0
10:20:23 AM: No npm workspaces detected
10:20:23 AM: Started restoring cached node modules
10:20:23 AM: Finished restoring cached node modules
10:20:23 AM: Installing NPM modules using NPM version 8.11.0
10:20:24 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:20:24 AM: npm WARN config location in the cache, and they are managed by
10:20:24 AM: npm WARN config cacache.
10:20:24 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:20:24 AM: npm WARN config location in the cache, and they are managed by
10:20:24 AM: npm WARN config cacache.
10:20:29 AM: > henil-k-portfolio-svelte@0.0.1 prepare
10:20:29 AM: > svelte-kit sync
10:20:29 AM: Your jsconfig.json should extend the configuration generated by SvelteKit:
10:20:29 AM: {
10:20:29 AM: “extends”: “./.svelte-kit/tsconfig.json”
10:20:29 AM: }
10:20:29 AM: added 51 packages, and audited 52 packages in 5s
10:20:29 AM: 6 packages are looking for funding
10:20:29 AM: run npm fund for details
10:20:29 AM: found 0 vulnerabilities
10:20:29 AM: NPM modules installed
10:20:29 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:20:29 AM: npm WARN config location in the cache, and they are managed by
10:20:29 AM: npm WARN config cacache.
10:20:29 AM: Started restoring cached go cache
10:20:29 AM: Finished restoring cached go cache
10:20:29 AM: go version go1.16.5 linux/amd64
10:20:29 AM: go version go1.16.5 linux/amd64
10:20:29 AM: Installing missing commands
10:20:29 AM: Verify run directory
10:20:31 AM: ​
10:20:31 AM: ────────────────────────────────────────────────────────────────
10:20:31 AM: Netlify Build
10:20:31 AM: ────────────────────────────────────────────────────────────────
10:20:31 AM: ​
10:20:31 AM: ❯ Version
10:20:31 AM: @netlify/build 27.1.3
10:20:31 AM: ​
10:20:31 AM: ❯ Flags
10:20:31 AM: baseRelDir: true
10:20:31 AM: buildId: 629993008504dc1b4595b116
10:20:31 AM: deployId: 629993008504dc1b4595b118
10:20:31 AM: ​
10:20:31 AM: ❯ Current directory
10:20:31 AM: /opt/build/repo
10:20:31 AM: ​
10:20:31 AM: ❯ Config file
10:20:31 AM: /opt/build/repo/netlify.toml
10:20:31 AM: ​
10:20:31 AM: ❯ Context
10:20:31 AM: production
10:20:31 AM: ​
10:20:31 AM: ────────────────────────────────────────────────────────────────
10:20:31 AM: 1. build.command from netlify.toml
10:20:31 AM: ────────────────────────────────────────────────────────────────
10:20:31 AM: ​
10:20:31 AM: $ npm run build
10:20:31 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:20:31 AM: npm WARN config location in the cache, and they are managed by
10:20:31 AM: npm WARN config cacache.
10:20:31 AM: > henil-k-portfolio-svelte@0.0.1 build
10:20:31 AM: > svelte-kit build
10:20:31 AM: Your jsconfig.json should extend the configuration generated by SvelteKit:
10:20:31 AM: {
10:20:31 AM: “extends”: “./.svelte-kit/tsconfig.json”
10:20:31 AM: }
10:20:32 AM: vite v2.9.9 building for production…
10:20:32 AM: transforming…
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:21:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 19:
10:20:32 AM: 20:
10:20:32 AM: 21: LinkedIn
10:20:32 AM: ^
10:20:32 AM: 22: Dribbble
10:20:32 AM: 23: Behance
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:22:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 20:
10:20:32 AM: 21: LinkedIn
10:20:32 AM: 22: Dribbble
10:20:32 AM: ^
10:20:32 AM: 23: Behance
10:20:32 AM: 24:
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:23:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 21: LinkedIn
10:20:32 AM: 22: Dribbble
10:20:32 AM: 23: Behance
10:20:32 AM: ^
10:20:32 AM: 24:
10:20:32 AM: 25:
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:31:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 29:
10:20:32 AM: 30:
10:20:32 AM: 31: About
10:20:32 AM: ^
10:20:32 AM: 32: Works
10:20:32 AM: 33: Contact
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:32:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 30:
10:20:32 AM: 31: About
10:20:32 AM: 32: Works
10:20:32 AM: ^
10:20:32 AM: 33: Contact
10:20:32 AM: 34:
10:20:32 AM: 4:50:32 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/Footer.svelte:33:23 A11y: ‘’ is not a valid href attribute
10:20:32 AM: 31: About
10:20:32 AM: 32: Works
10:20:32 AM: 33: Contact
10:20:32 AM: ^
10:20:32 AM: 34:
10:20:32 AM: 35:
10:20:33 AM: 4:50:33 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/HomepageBlocks/HomeCaseStudies.svelte:16:12 A11y: element should have an href attribute
10:20:33 AM: 14:


10:20:33 AM: 15:

Outcomes that brings value


10:20:33 AM: 16:

10:20:33 AM: ^
10:20:33 AM: 17: See All Projects
10:20:33 AM: 18:
10:20:33 AM: 4:50:33 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/HomepageBlocks/HomeCaseStudies.svelte:83:4 Unused CSS selector “.case-study-header p”
10:20:33 AM: 81: }
10:20:33 AM: 82:
10:20:33 AM: 83: .case-study-header p {
10:20:33 AM: ^
10:20:33 AM: 84: font-size: 18px;
10:20:33 AM: 85: font-weight: 600;
10:20:33 AM: 4:50:33 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/HomepageBlocks/HomeReviews.svelte:17:8 $: has no effect outside of the top-level
10:20:33 AM: 15:
10:20:33 AM: 16: afterUpdate(() => {
10:20:33 AM: 17: $: {
10:20:33 AM: ^
10:20:33 AM: 18: if(activeReviewIndex === 0) {
10:20:33 AM: 19: document.querySelector(".btn-0").setAttribute(“data-z”, “6”);
10:20:33 AM: 4:50:33 AM [vite-plugin-svelte] /opt/build/repo/src/lib/components/MobileNavDrawer.svelte:11:8 $: has no effect outside of the top-level
10:20:33 AM: 9:
10:20:33 AM: 10: afterUpdate(() => {
10:20:33 AM: 11: $: {
10:20:33 AM: ^
10:20:33 AM: 12: if(show) {
10:20:33 AM: 13: document.querySelector(“body”).style.overflow = “hidden”;
10:20:34 AM: ✓ 83 modules transformed.
10:20:34 AM: rendering chunks…
10:20:34 AM: .svelte-kit/output/client/_app/immutable/manifest.json 3.70 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/error.svelte-6de44301.js 1.56 KiB / gzip: 0.74 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/__layout.svelte-fee4bddf.js 14.31 KiB / gzip: 4.77 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/about.svelte-e65640ec.js 7.11 KiB / gzip: 2.62 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/contact.svelte-61d36451.js 0.62 KiB / gzip: 0.41 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/resume.svelte-3188bd59.js 0.15 KiB / gzip: 0.14 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/works.svelte-7d89e627.js 2.37 KiB / gzip: 1.17 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/start-a4badadc.js 25.15 KiB / gzip: 9.28 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/index-a2891d4b.js 0.79 KiB / gzip: 0.38 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/pages/index.svelte-449e6f1c.js 25.62 KiB / gzip: 8.50 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/HomepageBlockContainer-b26e6108.js 2.79 KiB / gzip: 1.37 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/HomepageBlockContainer-2ce7851f.css 0.25 KiB / gzip: 0.16 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/index-5be10da4.js 10.61 KiB / gzip: 4.46 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/CaseStudy-bd52d3b4.js 4.34 KiB / gzip: 1.94 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/ContactFooter-b0131680.js 15.57 KiB / gzip: 5.53 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/CaseStudy-00b99474.css 1.06 KiB / gzip: 0.30 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/ContactFooter-bdfbd9d4.css 3.58 KiB / gzip: 0.84 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/pages/__layout.svelte-d9a743eb.css 3.97 KiB / gzip: 1.15 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/pages/works.svelte-adc48cf4.css 0.27 KiB / gzip: 0.18 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/pages/about.svelte-523c4837.css 6.43 KiB / gzip: 1.57 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/assets/pages/index.svelte-61d122e6.css 10.67 KiB / gzip: 2.50 KiB
10:20:34 AM: .svelte-kit/output/client/_app/immutable/chunks/SplideSlide-31740a43.js 37.28 KiB / gzip: 15.67 KiB
10:20:34 AM: > %svelte.assets% in src/app.html should be replaced with %sveltekit.assets%
10:20:34 AM: at load_template (file:///opt/build/repo/node_modules/@sveltejs/kit/dist/cli.js:796:10)
10:20:34 AM: at build_server (file:///opt/build/repo/node_modules/@sveltejs/kit/dist/chunks/index.js:515:14)
10:20:34 AM: at build (file:///opt/build/repo/node_modules/@sveltejs/kit/dist/chunks/index.js:1307:23)
10:20:34 AM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
10:20:34 AM: at async file:///opt/build/repo/node_modules/@sveltejs/kit/dist/cli.js:1030:40
10:20:34 AM: ​
10:20:34 AM: ────────────────────────────────────────────────────────────────
10:20:34 AM: “build.command” failed
10:20:34 AM: ────────────────────────────────────────────────────────────────
10:20:34 AM: ​
10:20:34 AM: Error message
10:20:34 AM: Command failed with exit code 1: npm run build (
Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
10:20:37 AM: Creating deploy upload records
10:20:34 AM: ​
10:20:34 AM: Error location
10:20:34 AM: In build.command from netlify.toml:
10:20:37 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
10:20:34 AM: npm run build
10:20:34 AM: ​
10:20:34 AM: Resolved config
10:20:34 AM: build:
10:20:34 AM: command: npm run build
10:20:34 AM: commandOrigin: config
10:20:34 AM: publish: /opt/build/repo/build
10:20:34 AM: publishOrigin: config
10:20:34 AM: functions:
10:20:34 AM: ‘*’:
10:20:34 AM: node_bundler: esbuild
10:20:35 AM: Caching artifacts
10:20:35 AM: Started saving node modules
10:20:35 AM: Finished saving node modules
10:20:35 AM: Started saving build plugins
10:20:35 AM: Finished saving build plugins
10:20:35 AM: Started saving pip cache
10:20:35 AM: Finished saving pip cache
10:20:35 AM: Started saving emacs cask dependencies
10:20:35 AM: Finished saving emacs cask dependencies
10:20:35 AM: Started saving maven dependencies
10:20:35 AM: Finished saving maven dependencies
10:20:35 AM: Started saving boot dependencies
10:20:35 AM: Finished saving boot dependencies
10:20:35 AM: Started saving rust rustup cache
10:20:35 AM: Finished saving rust rustup cache
10:20:35 AM: Started saving go dependencies
10:20:35 AM: Finished saving go dependencies
10:20:37 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:20:37 AM: Failing build: Failed to build site
10:20:37 AM: Finished processing build request in 22.526273616sPreformatted text

Hiya, welcome to the Netlify Forums!

Sorry you are having trouble with your build. This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, a link to your site, what your build settings are, your package.json, etc. Thanks!

image

This error says that something is wrong with netlify.toml file.

Here is code of that file

[build]
  command = "npm run build"
  publish = "build"

[functions]
  node_bundler = "esbuild"

Please help me with this.

Hey @henilpatel

The issue isn’t in the netlify.toml, or the command specified, but in the outcome of that command.

There are numerous errors generated by the build script such as

You will need to address each error in the listed in the log to get the project built.