由php构建的docker容器上的Yarn错误:7.4-fpm dockerfile

hrirmatl  于 2023-02-21  发布在  Docker
关注(0)|答案(1)|浏览(190)

我正在尝试将Yarn安装到从dockerfile构建的容器中:

FROM php:7.4-fpm
...
// install node
RUN echo "deb https://deb.nodesource.com/node_6.x jessie main" >> /etc/apt/sources.list.d/nodejs.list && \
wget -nv -O -  https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> /etc/apt/sources.list.d/nodejs.list && \
apt-get update && \
apt-get install -y --force-yes nodejs && \
rm -f /etc/apt/sources.list.d/nodejs.list
// install yarn 
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add - && \
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install --no-install-recommends yarn

然后,在容器内:

yarn --version
0.32+git

当我尝试运行Yarn安装时,出现错误

ctehm74n

ctehm74n1#

对于Yarn,请尝试以下操作:

RUN apt-get install -y gnupg

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add - && \
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y --no-install-recommends yarn

对于节点i,建议如下:

RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
RUN bash nodesource_setup.sh
RUN apt-get install nodejs
RUN rm nodesource_setup.sh

相关问题