etherpad-lite icon indicating copy to clipboard operation
etherpad-lite copied to clipboard

Issue with cross-env to build an image

Open phls opened this issue 2 years ago • 2 comments

Hi, I'm trying to build a new image with the current code before apply any change on settings.json and build my image.

I copied docker-compose.dev.yml to docker-compose-production.yml change the lines:

  • target: production
  • NODE_ENV: production

Set all the he variables DOCKER_COMPOSE... and ran:

docker compose -f docker-compose-production.yml up -d

but I'm getting this:

# docker container logs etherpad-lite-app-1

> [email protected] prod /opt/etherpad-lite
> pnpm --filter ep_etherpad-lite run prod


> [email protected] prod /opt/etherpad-lite/src
> cross-env NODE_ENV=production node --require tsx/cjs node/server.ts

sh: cross-env: not found
/opt/etherpad-lite/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] prod: `cross-env NODE_ENV=production node --require tsx/cjs node/server.ts`
spawn ENOENT
 WARN   Local package.json exists, but node_modules missing, did you mean to install?
 ELIFECYCLE  Command failed with exit code 1.

Any suggestion about What I can do to fix it?

Best regards,

phls avatar Jul 21 '24 22:07 phls

Hi, I'm trying to build a new image with the current code before apply any change on settings.json and build my image.

I copied docker-compose.dev.yml to docker-compose-production.yml change the lines:

  • target: production
  • NODE_ENV: production

Set all the he variables DOCKER_COMPOSE... and ran:

docker compose -f docker-compose-production.yml up -d

but I'm getting this:

# docker container logs etherpad-lite-app-1

> [email protected] prod /opt/etherpad-lite
> pnpm --filter ep_etherpad-lite run prod


> [email protected] prod /opt/etherpad-lite/src
> cross-env NODE_ENV=production node --require tsx/cjs node/server.ts

sh: cross-env: not found
/opt/etherpad-lite/src:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] prod: `cross-env NODE_ENV=production node --require tsx/cjs node/server.ts`
spawn ENOENT
 WARN   Local package.json exists, but node_modules missing, did you mean to install?
 ELIFECYCLE  Command failed with exit code 1.

Any suggestion about What I can do to fix it?

Best regards,

Hi could you try the normal docker-compose.yml instead of the dev one? Dev was only meant for local development in docker and I think it maps the local directory with node_modules into the container. So if you didn't install it manually from outside the container the node_modules won't be there.

SamTV12345 avatar Jul 22 '24 08:07 SamTV12345

Thanks, it worked.

I thought I had tried to use docker-compose.yml to run the container before and it had failled. But I realized now I hadn't.

I will modify the Dockerfile and try build it.

phls avatar Jul 22 '24 13:07 phls