Skip to content
This repository was archived by the owner on Jul 14, 2022. It is now read-only.
This repository was archived by the owner on Jul 14, 2022. It is now read-only.

Error: Cannot find module '@next/bundle-analyzer' #1137

@matteius

Description

@matteius

What I'm trying to achieve

Trying to run saleor-platform locally which calls out saleor-storefront. I feel I am getting close to having it all startup proper, but having issues with this repo.

storefront_1  | ready - started server on 0.0.0.0:3000, url: http://localhost:3000
storefront_1  | info  - Loaded env from /app/.env
dashboard_1   | [10:58:58] Load GraphQL schemas [completed]
dashboard_1   | [10:58:58] Load GraphQL documents [started]
storefront_1  | { Error: Cannot find module '@next/bundle-analyzer'
storefront_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
storefront_1  |     at Function.mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:4:1855)
storefront_1  |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
storefront_1  |     at Module.require (internal/modules/cjs/loader.js:692:17)
storefront_1  |     at require (internal/modules/cjs/helpers.js:25:18)
storefront_1  |     at Object.<anonymous> (/app/next.config.js:1:28)
storefront_1  |     at Module._compile (internal/modules/cjs/loader.js:778:30)
storefront_1  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
storefront_1  |     at Module.load (internal/modules/cjs/loader.js:653:32)
storefront_1  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12) code: 'MODULE_NOT_FOUND' }
storefront_1  | npm ERR! code ELIFECYCLE
storefront_1  | npm ERR! errno 1
storefront_1  | npm ERR! react-storefront@0.1.0 start: `next start`
storefront_1  | npm ERR! Exit status 1
storefront_1  | npm ERR! 
storefront_1  | npm ERR! Failed at the react-storefront@0.1.0 start script.
storefront_1  | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
storefront_1  | 
storefront_1  | npm ERR! A complete log of this run can be found in:
storefront_1  | npm ERR!     /root/.npm/_logs/2022-05-02T10_58_58_702Z-debug.log

Steps to reproduce the problem

  1. I use this docker-compose.yml
version: "2"

services:
  api:
    ports:
      - 8000:8000
    build:
      context: https://github.com/saleor/saleor.git#3.3.2
      dockerfile: ./Dockerfile
      args:
        STATIC_URL: "/static/"
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    depends_on:
      - db
      - redis
      - jaeger
    volumes:
      - ./saleor/saleor/:/app/saleor:Z
      - ./saleor/templates/:/app/templates:Z
      - ./saleor/tests/:/app/tests
      # shared volume between worker and api for media
      - saleor-media:/app/media
    command: python manage.py runserver 0.0.0.0:8000
    env_file:
      - common.env
      - backend.env
    environment:
      - JAEGER_AGENT_HOST=jaeger
      - STOREFRONT_URL=http://127.0.0.1:3000/
      - DASHBOARD_URL=http://127.0.0.1:9000/
      - ALLOWED_HOSTS=localhost,api

  storefront:
    build:
      context: https://github.com/saleor/saleor-storefront.git#2.11.0
      dockerfile: ./Dockerfile.dev
    ports:
      - 3000:3000
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    depends_on:
      - api
    volumes:
      - ./react-storefront/:/app:cached
      - /app/node_modules/
    # Nginx is used to proxy SSR requests thru docker networking
    command: npm run start
    environment:
      - NEXT_PUBLIC_API_URI=http://localhost:8000/graphql/
      - NEXT_PUBLIC_HOMEPAGE_MENU=navbar

  dashboard:
    build:
      context: https://github.com/saleor/saleor-dashboard.git#main
      dockerfile: ./Dockerfile.dev
    ports:
      - 9000:9000
    restart: unless-stopped
    volumes:
      - ./saleor-dashboard/:/app:cached
      - /app/node_modules/
    command: npm start -- --host 0.0.0.0

  db:
    image: library/postgres:13-alpine
    ports:
      - 5432:5432
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    volumes:
      - saleor-db:/var/lib/postgresql/data
      - ./replica_user.sql:/docker-entrypoint-initdb.d/replica_user.sql
    environment:
      - POSTGRES_USER=saleor
      - POSTGRES_PASSWORD=saleor

  redis:
    image: library/redis:5.0-alpine
    ports:
      - 6379:6379
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    volumes:
      - saleor-redis:/data

  worker:
    build:
      context: https://github.com/saleor/saleor.git#3.3.2
      dockerfile: ./Dockerfile
      args:
        STATIC_URL: "/static/"
    command: celery -A saleor --app=saleor.celeryconf:app worker --loglevel=info -B
    restart: unless-stopped
    networks:
      - saleor-backend-tier
    env_file:
      - common.env
      - backend.env
    depends_on:
      - redis
      - mailhog
    volumes:
      - ./saleor/saleor/:/app/saleor:Z,cached
      - ./saleor/templates/:/app/templates:Z,cached
      # shared volume between worker and api for media
      - saleor-media:/app/media

  jaeger:
    image: jaegertracing/all-in-one
    ports:
      - "5775:5775/udp"
      - "6831:6831/udp"
      - "6832:6832/udp"
      - "5778:5778"
      - "16686:16686"
      - "14268:14268"
      - "9411:9411"
    restart: unless-stopped
    networks:
      - saleor-backend-tier

  mailhog:
    image: mailhog/mailhog
    ports:
      - 1025:1025 # smtp server
      - 8025:8025 # web ui. Visit http://localhost:8025/ to check emails
    restart: unless-stopped
    networks:
      - saleor-backend-tier

volumes:
  saleor-db:
    driver: local
  saleor-redis:
    driver: local
  saleor-media:

networks:
  saleor-backend-tier:
    driver: bridge
  1. Run docker-compose build
  2. Run docker-compose up

What I expected to happen

To be able to run the project without getting this Error: Cannot find module '@next/bundle-analyzer'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions