I am trying to run the app using the provided docker-compose file, I have setup the compose file for postgres and when try to run with
docker-compose up -d
the application crashed with the following message
Error: Cannot find module '@libsql/linux-arm64-musl' Require stack: - /home/node/app/node_modules/libsql/index.js - /home/node/app/node_modules/@libsql/client/lib-cjs/sqlite3.js - /home/node/app/node_modules/@libsql/client/lib-cjs/node.js - /home/node/app/node_modules/drizzle-kit/utils.js - /home/node/app/node_modules/@payloadcms/db-postgres/dist/connect.js - /home/node/app/node_modules/@payloadcms/db-postgres/dist/index.js - /home/node/app/src/payload.config.ts - /home/node/app/node_modules/payload/dist/config/load.js - /home/node/app/node_modules/payload/dist/payload.js - /home/node/app/node_modules/payload/dist/initHTTP.js - /home/node/app/node_modules/payload/dist/index.js - /home/node/app/src/server.ts at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15) at Function.Module._load (node:internal/modules/cjs/loader:922:27) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:119:18) at Object.<anonymous> (/home/node/app/node_modules/libsql/index.js:33:24) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Object.require.extensions.<computed> [as .js] (/home/node/app/node_modules/ts-node/src/index.ts:1045:43) at Module.load (node:internal/modules/cjs/loader:1119:32) at Function.Module._load (node:internal/modules/cjs/loader:960:12)
I tried to stop the application from docker and run it using
and it worked, its just not working in docker. The error seems to be in the
package - not sure about it
Do you use ARM for any reason?
I am on Mac Mini M2
Not sure about ARM
Ok, and you 'll deploy it on a ARM system too?
because amd64 is much more present in hosting solutions
Yep it's ARM64
was just testing it out, do i need to change the platform in docker-compose ?
or it won't work on my pc ?
if you want to run your docker on your mac, you should create the image from your mac, or ARM64 machine
but most of VPS or cloud solution, use only AMD64
the postgres image is working and I am able to connect the application with it
If I run "yarn dev" it connect with postgres and work fine, but the application is crashing in docker
Do i have to configure anything to make it work?
yes that not the problem, but I think its simplier to directly test your docker image on a production env
you could install the libs required yes
add the command on your Dockerfile and rerun a build
Okay, will try that
And yeah you must use a node arm64 as base
instead of node:18-apline ?
yep, if you run on your mac
hmm, still getting the same error
show me your Dockerfile
FROM arm64v8/node:18-alpine as base FROM base as builder WORKDIR /home/node/app COPY package*.json ./ COPY . . RUN yarn install RUN yarn build FROM base as runtime ENV NODE_ENV=production ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js WORKDIR /home/node/app COPY package*.json ./ RUN yarn install --production COPY --from=builder /home/node/app/dist ./dist COPY --from=builder /home/node/app/build ./build EXPOSE 3000 CMD ["node", "dist/server.js"]
version: "3" services: payload: image: arm64v8/node:18-alpine container_name: payload-2-0 ports: - "3000:3000" volumes: - .:/home/node/app - node_modules:/home/node/app/node_modules working_dir: /home/node/app/ command: sh -c "yarn install && yarn dev" depends_on: - postgres env_file: - .env postgres: image: postgres container_name: postgres-c ports: - "5432:5432" volumes: - data:/var/lib/postgresql/data environment: - POSTGRES_PASSWORD=postgres volumes: data: node_modules:
that's a dev environnement, not the way you will deploy it, are you aware of that?
command: sh -c "yarn install && yarn add @libsql/linux-arm64-musl && yarn dev"
try with this command?
yarn install v1.22.19 [1/4] Resolving packages... [2/4] Fetching packages... warning email@example.com: The engine "pnpm" appears to be invalid. [3/4] Linking dependencies... warning " > @firstname.lastname@example.org" has unmet peer dependency "email@example.com". warning "@payloadcms/bundler-webpack > firstname.lastname@example.org" has unmet peer dependency "@swc/core@^1.2.147". warning "@payloadcms/bundler-webpack > email@example.com" has unmet peer dependency "@swc/core@^1.0.0". warning " > @firstname.lastname@example.org" has unmet peer dependency "better-sqlite3@^8.5.0". warning " > @email@example.com" has unmet peer dependency "nodemailer@^6.9.0". warning " > @firstname.lastname@example.org" has incorrect peer dependency "payload@^1.6.21". warning "@payloadcms/richtext-slate > @email@example.com" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0". warning "@payloadcms/richtext-slate > firstname.lastname@example.org" has unmet peer dependency "react-dom@>=16.8.0". warning "@payloadcms/richtext-slate > @faceless-ui/modal > email@example.com" has unmet peer dependency "react-dom@>=16.6.0". warning Workspaces can only be enabled in private projects. [4/4] Building fresh packages... Done in 57.51s. yarn add v1.22.19 [1/4] Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/@libsql%2flinux-arm64-musl: Not found". info If you think this is a bug, please open a bug report with the information provided in "/home/node/app/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
got an error
package not found
make the inverse 😂
yarn add the package first, before yarn install
That package installation just not work, I had tried it doing manually and got the error
Also just tried vite bundler, its also not working
its stuck on
Payload Admin URL: /admin
yarn run v1.22.19 $ cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon [nodemon] 2.0.22 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: ts [nodemon] starting `ts-node src/server.ts -- -I` [12:32:48] INFO (payload): Starting Payload... [12:32:48] INFO (payload): Payload Admin URL: /admin
Changing back to webpackBunder is working
what do you mean by stuck?
it was stuck there for almost 5 minutes
on the log?
tried accessing the application on localhost:300 but it did not worked
yes on log
you run with docker?
with "yarn dev"
its working with webpackBundler
stay on webpack, Vite is on beta actually
okay, I had used payload I think around 6 months ago, trying learn it for good now
will explore all the new features introduced
Thanks for the great release 🙏
I think the team need a little bit of time to fix some errors, but yeah let's try 😉
Yeah there is an issue somehow
My coworker has m2
m1pro / pnpm here
for now my coworker has to do regular yarn dev on his machine
It's more a beta version actually than the release 🙈