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
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.
You tan yarn to install dependencies first right? Does your droplet have yarn installed?
Hi dude, yes I have Yarn already instaled. Looks like when
is executed seomething goes worng
But it builds locally?
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
Do you have an env file on your server?
You don’t need to install anything other than what gets installed by running
I think cross-env is in the package.json, but you could double check?
yes cross-env is there... Humm I noticed that the missing guy is dotenv:
console.log(dotnev); ^ ReferenceError: dotnev is not defined
you mean dotenv?
oh my bad
so idk.. locally errors are more descriptive
Hmmm it’s gotta be something simple 🤔
absolutely, the man between the chair and pc lol
I can't imagine the dopamine shot I'll get when it is fixed..
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
I noticed Im getting "killed" then yarn install
I'll to expand my 4$/m droplet , maybe its the issue
Oooooo yeah not sure if the smallest droplet has enough mem
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.
@ninotorres_ what droplet did you end up with? I'm getting the same issue with a $8/mo 1gb droplet
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.
Hope this is helpful!