nest-modules / mailer

📨 A mailer module for Nest framework (node.js)
https://nest-modules.github.io/mailer/
MIT License
837 stars 176 forks source link

Error: Cannot find module '@css-inline/css-inline-linux-x64-musl' #1128

Closed wagnersillva closed 6 months ago

wagnersillva commented 6 months ago

I'm using Dcoker to deploy my nestjs application.

Error:

stock-in-cloud@0.0.1 start:prod node dist/main

/user/src/app/server/node_modules/@css-inline/css-inline/index.js:250 throw loadError ^

Error: Cannot find module '@css-inline/css-inline-linux-x64-musl' Require stack:


version in use => @nestjs-modules/mailer "^1.10.3"

cmoreira-handtevy commented 6 months ago

Having the same issue, but only when using Node 20. Switching to node 18 seems to work for me.

wagnersillva commented 6 months ago

I only was install @css-inline/css-inline-linux-x64-musl and this work for me.

This is my new dockerfile:


# Installing dependencies:

FROM node:18-alpine AS install-dependencies

RUN apk update && apk add chromium

WORKDIR /user/apps/server

COPY . .

RUN npm install --quiet --no-optional --no-fund --loglevel=error

# Adicionado temporariamente (falha na atualização de @nestjs-modules/mailer`)
RUN npm install @css-inline/css-inline-linux-x64-musl

RUN npm run build

EXPOSE 3000

CMD ["npm", "run", "start:prod"]
josebright commented 1 month ago

I think I figured out the issue.

Go to the files directory inside your docker and confirm if the files were mounted. Example of files that is not mounted is below otherwise you will see mount:

image

If it is mounted, then you will need to remove volumes from your app service in the docker-compose.yml file. Sample of my file is below:

version: '3.8'
services:
  postgres:
    image: postgres
    restart: always
    env_file:
      - .env
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    ports:
      - '5434:5432'
    volumes: 
      - goeliteapp:/var/lib/postgresql/data

  app:
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      - postgres
    container_name: api-project
    working_dir: /app
    restart: always
    env_file:
      - .env
    environment:
      ENVIRONMENT: ${ENVIRONMENT}
      PORT: 3000
      DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=public
    ports:
      - "3030:3000"
    command: ["/bin/sh", "-c", "./entrypoint.sh"]   #This is because I am using a script

volumes:
  goeliteapp:

Also, include the below in your .dockerignore .DS_Store /src/.DS_Store

After that, run the below commands and your docker will work properly:

docker compose down
docker compose build build --no-cache
docker compose up