npm 'missing script payload'

default discord avatar
3 weeks ago

Kia ora!

I'm running payload via the Astroad docker containers, and am struggling to get migrations working.

I initially had a unique 'slug' field in some collections I realised I didn't need, so I removed it from my payload config. I'm running into issues (getting the 'slug not unique' error) so I assume MongoDB is unhappy because it's still expecting a unique slug. I want to run a migration to remove this field totally.

However, after adding the 'payload' script to package.json, trying to run 'npm run payload migrate' gives me a 'missing script: "payload"' error.

I'm running payload 2.1

  • discord user avatar
    Payload Team
    3 weeks ago

    This script should be included in all of our templates.

    If you happen to not have it, this is what needs to exist in your package.json's scripts (or similar):

      "scripts": {
        "payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"

    Some more detail here if you need it:
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.