/node_modules/.bin/../node/bin/node: 1: This: not found

Problem:

I set up a Docker Compose on my Linux (Kubuntu) laptop that includes a python container which runs Django and uses React for a Frontend. When I brought the Docker files over to my Windows 10 desktop, I am getting the following error:
/node_modules/.bin/../node/bin/node: 1: This: not found

My efforts so far:

I’ve found an existing StackOverflow question with no answer and another with only a comment that led to a GitHub issue on the now-archived npm repo, but none of these seem to apply to Docker. I tried to follow the directions that seemed to solve the issue for most people in the GitHub issue, but I am using nvm on my Windows machine and do not have a C:/Users/{username}/AppData/Roaming/npm or C:/Users/{username}/AppData/Roaming/npm-cache folder to delete. I did try changing my Node version using nvm, but the error persists. I’m also not convinced that the error should be happening in a Docker container even if there was an issue with Node/npm on my Windows system; the Docker is installing Node directly from source (see below for details).

I’m at a bit of a dead end of what else to check, suggestions appreciated.

Setup Details:

All the details can be seen at my GitHub branch for trying to get this up and running, but I’ll include the Dockerfile for the affected container as well as the compose file here for convenience. GitHub is not tracking my node_modules directory because it’s so large, but if I should include details about that let me know and I will provide them. My package.json and package-lock.json can be found in the Frontend directory.

Python container Dockerfile:

# syntax=docker/dockerfile:1

ARG PYTHON_VERSION=3.12.2
FROM python:${PYTHON_VERSION} AS base

RUN apt-get update 
    && apt-get upgrade -y 
    && apt-get install -y sudo gcc default-libmysqlclient-dev pkg-config 
    && rm -rf /var/lib/apt/lists/*

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN useradd -m --uid "${UID}" appuser
RUN echo 'appuser:askStackOverflow' | chpasswd
RUN usermod -aG sudo appuser

# Create a sudoers configuration file in /etc/sudoers.d/
RUN echo 'appuser localhost=(root) NOPASSWD: /usr/bin/npm' > /etc/sudoers.d/myuser 
    && chmod 440 /etc/sudoers.d/myuser 
    && chown root:root /etc/sudoers.d/myuser


RUN cd /home/appuser/
WORKDIR /home/appuser/

# Copy the source code into the container.
COPY . /home/appuser/

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN --mount=type=cache,target=/root/.cache/pip 
    --mount=type=bind,source=requirements.txt,target=requirements.txt 
    pip install --root-user-action=ignore --upgrade pip 
    && pip install --root-user-action=ignore mysqlclient 
    && pip install --root-user-action=ignore -r requirements.txt


RUN curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get -y install nodejs

# Switch to the non-privileged user to run the application.
# USER appuser

WORKDIR /home/appuser/Frontend/
RUN sudo /usr/bin/npm install

VOLUME /home/appuser/Frontend/src/
VOLUME /home/appuser/MemeCataloger2/
VOLUME /home/appuser/api/
VOLUME /home/appuser/Sockets/

WORKDIR /home/appuser/

# Expose the port that the application listens on.
EXPOSE 8000

# Make migrations to the database
RUN python manage.py makemigrations

# Run the application.
CMD ["bash", "-c", "python manage.py migrate & python manage.py runserver 0.0.0.0:8000 & cd /home/appuser/Frontend/ && npm run dev"]

compose.yaml:

services:
  db:
    build:
      context: ./MySqlDockerSetup
    restart: always
    user: root
    secrets:
      - db-password
      - django-db-password
    volumes:
      - db-data:/var/lib/mysql
    # environment:
      # MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
      # MYSQL_USER: django
      # MYSQL_PASSWORD_FILE: /run/secrets/django-db-password
    healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
        interval: 10s
        timeout: 10s
        retries: 3
    expose:
      - 3306:3306

  redis:
    image: redis:7
    ports:
     - 6379:6379

  server:
    build:
      context: .
    volumes:
        - ./Frontend/src:/home/appuser/Frontend/src:rshared
        - ./MemeCataloger2:/home/appuser/MemeCataloger2:rshared
        - ./api:/home/appuser/api:rshared
        - ./Sockets:/home/appuser/Sockets:rshared

    ports:
      - 8000:8000
    depends_on:
        db:
            condition: service_healthy

volumes:
    db-data:
    server-frontend-src:
    server-memecataloger2:
    server-api:
    server-sockets:

secrets:
  db-password:
    file: ./MySqlDockerSetup/db-password.txt
  django-db-password:
    file: ./MySqlDockerSetup/django-db-password.txt

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật