gpt4 book ai didi

node.js - Docker:未找到 npm

转载 作者:太空宇宙 更新时间:2023-11-04 03:16:52 26 4
gpt4 key购买 nike

我有以下 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: not found

有什么问题吗?你能帮我一下吗?

最佳答案

尝试在构建镜像时单独安装 npm:

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

关于node.js - Docker:未找到 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55258124/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com