如何在 Ubuntu 环境中安装特定版本的节点

How to install a specific version of node in a Ubuntu environment

当我docker run -it wordpress:php7.0-apache时,我可以执行所有以下命令

FROM wordpress:php7.0-apache
RUN apt-get update
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
RUN /bin/dash ~/.profile
RUN /bin/dash nvm install 8.11.4

我的问题是当我尝试 docker build -t imageName:version 时会出现错误: /bin/dash: 0: Can't open nvm The command '/bin/sh -c /bin/dash nvm install 8.11.4' returned a non-zero code: 1277

有什么区别?

谢谢大卫·梅兹。实际上不需要 nvm 来安装特定版本。 我的 Dockerfile 现在:

FROM wordpress:php7.0-apache
RUN apt-get update && apt-get install -y gnupg gnupg2 gnupg1
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs