Sapper: Deploy fails due to missing script (Script is defined in package.json)

I’d like to deploy a sapper app to netlify. When conducting the build via the CLI everything works fine, however during the netlify deploy the build fails with (affectionate-volhard-d70834):

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

The package.json is checked into the repo, so I cannot quite understand why the script cannot be found.

"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"
  },

Issue solved.
Removed node_modules, cleared cache and redeployed. Thanks.