Tom*_*asz 53
好的,我知道了,
# update
apt-get update
# install curl
apt-get install curl
# get install script and pass it to execute:
curl -sL https://deb.nodesource.com/setup_4.x | bash
# and install node
apt-get install nodejs
# confirm that it was successful
node -v
# npm installs automatically
npm -v
Run Code Online (Sandbox Code Playgroud)
使用curl -sL https://deb.nodesource.com/setup_5.x | bash节点5.x的
替换5为您想要的节点版本,例如 8、12 等。
小智 36
截至 2019 年 1 月更新的解决方案:
FROM ubuntu:latest
USER root
WORKDIR /home/app
COPY ./package.json /home/app/package.json
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get -y install nodejs
RUN npm install
Run Code Online (Sandbox Code Playgroud)
小智 13
这就是我将 nodeJS 安装到容器中的方式。就我而言,我使用的是 nginx 基础映像。
使用以下命令
apt-get update -yq \
&& apt-get install curl gnupg -yq \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash \
&& apt-get install nodejs -yq
Run Code Online (Sandbox Code Playgroud)
nodeJS 安装程序需要 GNUPG。没有它,您将收到以下错误消息;
[91mE: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
Run Code Online (Sandbox Code Playgroud)
小智 7
您可以在 Dockerfile 中添加一行。
FROM node:8.2
Run Code Online (Sandbox Code Playgroud)
这里有一个支持的标签名称列表:https : //hub.docker.com/_/node/
| 归档时间: |
|
| 查看次数: |
149987 次 |
| 最近记录: |