我正在尝试将 docker 与我的 Node 应用程序一起使用,我的 Dockerfile 如下所示:
RUN apt-get update
RUN apt-get -y install build-essential
RUN apt-get install -y nodejs
RUN apt-get install -y npm
ADD . /src
RUN cd /src && npm install
EXPOSE 8080
CMD ["node","/src/app.js"]
但是在尝试安装https://registry.npmjs.org/wordwrap/-/wordwrap-后运行
我收到错误:npm install
时运行docker build
0.0.2.tgz
The command 'bin/sh -c /src && npm install' returned a non-zero code : 1
什么会导致这样的问题?我已经尝试安装node-legacy而不是node,但它不起作用
最佳答案
试试这个:
# put this line on your code (if you are using ubuntu)
# this make a link from nodejs to node to add compatibility on ubuntu OS
RUN ln -s /usr/bin/nodejs /usr/bin/node
# set your current directory with WORKDIR
WORKDIR /src
RUN sudo npm install
关于node.js - Docker 与 Node.js 和 Express.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32995774/