Докер: npm не найден - PullRequest
       18

Докер: npm не найден

0 голосов
/ 20 марта 2019

У меня есть следующий Dockerfile:

FROM ubuntu
USER root
RUN apt-get update && apt-get install curl -y
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get update && apt-get upgrade -y && apt-get install nodejs -y
RUN mkdir /opt/public
RUN mkdir /opt/bin
ADD public /opt/public
ADD bin /opt/bin
RUN ls -lah /opt/bin
RUN ls -lah /opt/public
ADD run.sh /bin/run.sh
RUN chmod +x /bin/run.sh
RUN cd /opt/bin && npm install
CMD ["/bin/run.sh"]

Когда я собираю Контейнер, я получаю следующее сообщение:

/ bin / sh: 1: npm: не найдено

В чем проблема? Не могли бы вы помочь мне?

1 Ответ

1 голос
/ 20 марта 2019

Попробуйте установить npm отдельно при создании образа:

RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y nodejs \
    npm                       # note this one
...