error build digital ocean

default discord avatar
ninotorres_
2 months ago
16

hi guys!



I'm receiving the following error when I try to do npm run build into a digital ocean droplet



I'm using custom server repo



any clue?



root@ubuntu-s-1vcpu-512mb-10gb-sfo3-01:~/actions-runner/payloadfolio_actions/payloadfolio/payloadfolio# yarn build yarn run v1.22.19 $ cross-env NODE_ENV=production yarn build:payload && yarn build:server && yarn copyfiles && yarn build:next $ cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    You tan yarn to install dependencies first right? Does your droplet have yarn installed?

  • default discord avatar
    ninotorres_
    2 months ago

    Hi dude, yes I have Yarn already instaled. Looks like when

    payload build

    is executed seomething goes worng

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    But it builds locally?

  • default discord avatar
    ninotorres_
    2 months ago

    yes, locally works perfect



    I can run yarn install and all goes well, the thing is with yarn build



    looks like is stuck in $ cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build



    not sure if I need to install something else to read .env files or something like that

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    Do you have an env file on your server?



    You don’t need to install anything other than what gets installed by running

    yarn

    I think cross-env is in the package.json, but you could double check?

  • default discord avatar
    ninotorres_
    2 months ago

    yes cross-env is there... Humm I noticed that the missing guy is dotenv:



    console.log(dotnev); ^ ReferenceError: dotnev is not defined
  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    you mean dotenv?

  • default discord avatar
    ninotorres_
    2 months ago

    oh my bad



    dotenv exists



    so idk.. locally errors are more descriptive

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    Hmmm it’s gotta be something simple 🤔

  • default discord avatar
    ninotorres_
    2 months ago

    absolutely, the man between the chair and pc lol



    I can't imagine the dopamine shot I'll get when it is fixed..

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    And just to ensure parity from server to local, can you remove node modules and yarn lock file, then re install them and build locally

  • default discord avatar
    ninotorres_
    2 months ago

    I noticed Im getting "killed" then yarn install



    I'll to expand my 4$/m droplet , maybe its the issue

  • discord user avatar
    jarrod_not_jared
    Payload Team
    2 months ago

    Oooooo yeah not sure if the smallest droplet has enough mem

  • default discord avatar
    ninotorres_
    2 months ago

    I'm close to get it done



    Now the issue its on nextjs build:



    Verify the machine is running and has a healthy network connection. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.


    Its like build optimization takes much time



    do you know if we need to set something regarding payload access / digital ocean configs?



    I can try increase a bit more the droplet also, but I wan to discard if could be access related or something like that



    Ok:

    the issue have been solved

    and we are live 🙂 Thanks @jarrod_not_jared for your help:



    In order to fix that;



    1 - minimum digitalocean droplet size: At least 1GB memory to get it work. I started with 512MB droplet and was causing problems.



    2- Be aware of eslint errors, this causes errors in build.

  • default discord avatar
    2me2you
    last month

    @ninotorres_ what droplet did you end up with? I'm getting the same issue with a $8/mo 1gb droplet

    :whatthehell:
  • default discord avatar
    fturmel
    last month

    I've run into this problem before, the build step of just about any node project will need more than 512 MB of RAM. My solution has been to simply create a swap partition on the OS. The builds can then temporarily take up as much memory as they need by overflowing to disk.



    https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04

    Hope this is helpful!

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.