Sapper Build Fails: Missing Script

Name: affectionate-volhard-d70834

The netlify deploy fails due to a missing script. Yet, the package.json includes the build command, and when executed locally the build succeeds. What am I missing here?

Error Log:

4:15:12 PM: Build ready to start

4:15:17 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6

4:15:17 PM: build-image tag: v3.4.1

4:15:17 PM: buildbot version: fcbc7a79f7372e5995cf02954ef19fc48d20c871

4:15:17 PM: Fetching cached dependencies

4:15:17 PM: Failed to fetch cache, continuing with build

4:15:17 PM: Starting to prepare the repo for build

4:15:17 PM: No cached dependencies found. Cloning fresh repo

4:15:17 PM: git clone https://github.com/basti-n/personal-website

4:15:18 PM: Preparing Git Reference refs/heads/master

4:15:19 PM: Starting build script

4:15:19 PM: Installing dependencies

4:15:19 PM: Python version set to 2.7

4:15:20 PM: v12.18.0 is already installed.

4:15:21 PM: Now using node v12.18.0 (npm v6.14.4)

4:15:21 PM: Started restoring cached build plugins

4:15:21 PM: Finished restoring cached build plugins

4:15:21 PM: Attempting ruby version 2.7.1, read from environment

4:15:23 PM: Using ruby version 2.7.1

4:15:23 PM: Using PHP version 5.6

4:15:23 PM: 5.2 is already installed.

4:15:23 PM: Using Swift version 5.2

4:15:23 PM: Started restoring cached node modules

4:15:23 PM: Finished restoring cached node modules

4:15:24 PM: Installing NPM modules using NPM version 6.14.4

4:15:54 PM: > core-js@2.6.10 postinstall /opt/build/repo/node_modules/core-js

4:15:54 PM: > node postinstall || echo "ignore"

4:15:54 PM: > nuxt@2.10.1 postinstall /opt/build/repo/node_modules/nuxt

4:15:54 PM: > opencollective || exit 0

4:15:57 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/watchpack/node_modules/fsevents):

4:15:57 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

4:15:57 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/jest-haste-map/node_modules/fsevents):

4:15:57 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

4:15:57 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.1 (node_modules/fsevents):

4:15:57 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

4:15:57 PM: added 1452 packages from 727 contributors and audited 1588 packages in 32.259s

4:15:58 PM: found 41667 vulnerabilities (41607 low, 35 moderate, 25 high)

4:15:58 PM: run `npm audit fix` to fix them, or `npm audit` for details

4:15:58 PM: NPM modules installed

4:15:59 PM: Started restoring cached go cache

4:15:59 PM: Finished restoring cached go cache

4:15:59 PM: go version go1.14.4 linux/amd64

4:15:59 PM: go version go1.14.4 linux/amd64

4:15:59 PM: Installing missing commands

4:15:59 PM: Verify run directory

4:16:00 PM: ​

4:16:00 PM: ┌─────────────────────────────┐

4:16:00 PM: │ Netlify Build │

4:16:00 PM: └─────────────────────────────┘

4:16:00 PM: ​

4:16:00 PM: ❯ Version

4:16:00 PM: @netlify/build 3.3.0

4:16:00 PM: ​

4:16:00 PM: ❯ Flags

4:16:00 PM: deployId: 5f3be26f9001354f52c832ed

4:16:00 PM: mode: buildbot

4:16:00 PM: ​

4:16:00 PM: ❯ Current directory

4:16:00 PM: /opt/build/repo

4:16:00 PM: ​

4:16:00 PM: ❯ Config file

4:16:00 PM: No config file was defined: using default values.

4:16:00 PM: ​

4:16:00 PM: ❯ Context

4:16:00 PM: production

4:16:00 PM: ​

4:16:00 PM: ┌───────────────────────────────────┐

4:16:00 PM: │ 1. Build command from Netlify app │

4:16:00 PM: └───────────────────────────────────┘

4:16:00 PM: ​

4:16:00 PM: $ npm run build:netlify

4:16:00 PM: npm ERR! missing script: build:netlify

4:16:00 PM: npm ERR! A complete log of this run can be found in:

4:16:00 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-08-18T14_16_00_921Z-debug.log

4:16:00 PM: ​

4:16:00 PM: ┌─────────────────────────────┐

4:16:00 PM: │ "build.command" failed │

4:16:00 PM: └─────────────────────────────┘

4:16:00 PM: ​

4:16:00 PM: Error message

4:16:00 PM: Command failed with exit code 1: npm run build:netlify

4:16:00 PM: ​

4:16:00 PM: Error location

4:16:00 PM: In Build command from Netlify app:

4:16:00 PM: npm run build:netlify

4:16:00 PM: ​

4:16:00 PM: Resolved config

4:16:00 PM: build:

4:16:00 PM: command: 'npm run build:netlify'

4:16:00 PM: commandOrigin: ui

4:16:00 PM: publish: /opt/build/repo/public

4:16:01 PM: Caching artifacts

4:16:01 PM: Started saving node modules

4:16:01 PM: Finished saving node modules

4:16:01 PM: Started saving build plugins

4:16:01 PM: Finished saving build plugins

4:16:01 PM: Started saving pip cache

4:16:01 PM: Finished saving pip cache

4:16:01 PM: Started saving emacs cask dependencies

4:16:01 PM: Finished saving emacs cask dependencies

4:16:01 PM: Started saving maven dependencies

4:16:01 PM: Finished saving maven dependencies

4:16:01 PM: Started saving boot dependencies

4:16:01 PM: Finished saving boot dependencies

4:16:01 PM: Started saving go dependencies

4:16:01 PM: Finished saving go dependencies

4:16:04 PM: Error running command: Build script returned non-zero exit code: 1

4:16:04 PM: Failing build: Failed to build site

4:16:04 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1

4:16:04 PM: Finished processing build request in 47.416243212s

Here is my package.json

{
  "name": "personalwebsite",
  "description": "My personal Website",
  "version": "0.0.1",
  "scripts": {
    "dev": "sapper dev",
    "build": "sapper build --legacy",
    "build:netlify": "sapper export && mv ./__sapper__/export ./public",
    "export": "sapper export --legacy",
    "start": "node __sapper__/build",
    "cy:run": "cypress run",
    "cy:open": "cypress open",
    "test": "run-p --race dev cy:run"
  },
  "dependencies": {
    "compression": "^1.7.1",
    "polka": "next",
    "sirv": "^0.4.0",
    "sapper": "^0.27.0",
    "svelte": "^3.0.0",
    "svelte-preprocess": "^3.7.1"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-transform-runtime": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/runtime": "^7.0.0",
    "@rollup/plugin-commonjs": "11.0.2",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^7.0.0",
    "@rollup/plugin-replace": "^2.2.0",
    "autoprefixer": "^9.7.6",
    "node-sass": "^4.13.1",
    "npm-run-all": "^4.1.5",
    "rollup": "^1.20.0",
    "rollup-plugin-babel": "^4.0.2",
    "rollup-plugin-svelte": "^5.0.1",
    "rollup-plugin-terser": "^4.0.4"
  }
}

Issue solved.
Removed node_modules, cleared npm cache and redeployed successfully.

1 Like