#Build command starts payload instead of building

54 messages · Page 1 of 1 (latest)

bronze folio
#

Payload Version: 2.2.2

package.json scripts

    "build:payload": "PAYLOAD_CONFIG_PATH=src/payload.config.ts NODE_ENV=production payload build",
    "build:server": "tsc",
    "build": "npm run copyfiles && npm run build:payload && npm run build:server",
    "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",

I have a turborepo with frontend and payloadcms. When I run yarn build the build command never stops, instead seemingly Payload starts. I recently upgraded from payload 1.6. I think the problem started after the upgrade but just appeared now because of some caching.

There is also a warning about express-session but I think this has nothing to do with it. (i hope)

barren orioleBOT
compact oxide
#

Hmm, there is nothing in those commands that would be starting the application

#

That is odd

#

@humble aspen Any idea on this one?

humble aspen
#

Are you on the latest version of payload and all of its packages?

#

Ahh right yeah I see youre on 2.2.x, this is fixed post 2.8

bronze folio
#

It doesn't seem fixed for me. Now i installed the latest payload version and still payload build just starts payload. It is very confusing since it does exactly the same thing as my dev command (PAYLOAD_CONFIG_PATH=src/payload.config.ts node --require ts-node/register --inspect=10000 src/server.ts) just without attaching a debugger. At least the session warning is gone 🥲

bronze folio
bronze folio
#

@humble aspen can you du anything with this information?

compact oxide
#

I'd probably wipe your node_modules and install latest payload

bronze folio
#

i also updated sharp to the newest version, now i got this error when building:

projectname-cms:build: > [email protected] build:payload
projectname-cms:build: > PAYLOAD_CONFIG_PATH=src/payload.config.ts NODE_ENV=production payload build
projectname-cms:build: 
projectname-cms:build: /pathto/projectname/node_modules/sharp/lib/sharp.js:114
projectname-cms:build:   throw new Error(help.join('\n'));
projectname-cms:build:         ^
projectname-cms:build: 
#
projectname-cms:build: Error: Could not load the "sharp" module using the darwin-arm64 runtime
projectname-cms:build: Possible solutions:
projectname-cms:build: - Ensure optional dependencies can be installed:
projectname-cms:build:     npm install --include=optional sharp
projectname-cms:build:     yarn add sharp --ignore-engines
projectname-cms:build: - Ensure your package manager supports multi-platform installation:
projectname-cms:build:     See https://sharp.pixelplumbing.com/install#cross-platform
projectname-cms:build: - Add platform-specific dependencies:
projectname-cms:build:     npm install --os=darwin --cpu=arm64 sharp
projectname-cms:build: - Consult the installation documentation:
projectname-cms:build:     See https://sharp.pixelplumbing.com/install
projectname-cms:build:     at Object.<anonymous> (/pathto/projectname/node_modules/sharp/lib/sharp.js:114:9)
projectname-cms:build:     at Module._compile (node:internal/modules/cjs/loader:1241:14)
projectname-cms:build:     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
projectname-cms:build:     at Object.newLoader [as .js] (/pathto/projectname/node_modules/pirates/lib/index.js:121:7)
projectname-cms:build:     at Module.load (node:internal/modules/cjs/loader:1091:32)
projectname-cms:build:     at Module._load (node:internal/modules/cjs/loader:938:12)
projectname-cms:build:     at Module.require (node:internal/modules/cjs/loader:1115:19)
projectname-cms:build:     at require (node:internal/modules/helpers:130:18)
projectname-cms:build:     at Object.<anonymous> (/pathto/projectname/node_modules/sharp/lib/constructor.js:10:1)
projectname-cms:build:     at Module._compile (node:internal/modules/cjs/loader:1241:14)
stoic wharf
#

facing the same issue on turborepo, you could get over it with yarn workspace cms add sharp --ignore-engines

#

but then you maybee also will have the old problem again... build starts the dev process

stoic wharf
#

i think i finally found it... also remove all the .turbo directories

stoic wharf
#

sadly not, no following builds same happens again.

stoic wharf
#

@humble aspen or @compact oxide any idea/hint what to check? need to ship the update and this bug is thriving me crazy.

compact oxide
#

Hey @stoic wharf I was off yesterday

#

Still having an issue?

stoic wharf
#

Yes

compact oxide
#

So you're on turborepo

#

and you cant build sharp?

stoic wharf
#

I tried a lot of things. Node versions, fresh installations,..

#

Sharp is not the issue

#

I can downgrade it

compact oxide
#

Well sharp is causing node-gyp to do a rebuild right

stoic wharf
#

But on payload build it starts the payload server

compact oxide
#

OK, sorry, what is the issue?

#

Oh the auto start?

stoic wharf
#

Yes

compact oxide
#

I remember now

#

It's odd that it's autostarting

stoic wharf
#

I checked the cli code but i do not get a reason why

compact oxide
#

and its hosted on turborepo?

#

That

#

That's where it happens?

#

@stoic wharf

humble aspen
#

Is this using npm? Maybe try pnpm?

#

If not this might be a case where sharing a repo is the easiest way to figure it out

compact oxide
#

@humble aspen What do you think could be triggering the run command from build?

#

My thought was that if they were on some provider like turbo, it was calling run after by default

stoic wharf
#

Sorry had to leave for a meeting

#

I am using yarn

#

It was not an issue with payload 1.6

#

For the hosting … build a docker image

humble aspen
#

is it possible to test pnpm? just to eliminate the package manager as an issue

#

yarn v1 is now the old npm when it comes to module resolution, we've seen a few issues with it

stoic wharf
#

never worked with pnpm but should be not a big deal

stoic wharf
#

😮‍💨 pnpm could not find the turbo installation

compact oxide
stoic wharf
#

@compact oxide @humble aspen finally we found the issue, we have created collection filters and stored them in the collection directory. Moving them out and everything builds as expected... 🤯

humble aspen
#

interesting