npm 'missing script payload'

default discord avatar
jennifilm
3 weeks ago
1

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
    denolfe
    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:

    https://github.com/payloadcms/payload/releases/tag/v2.0.0
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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