繁体   English   中英

带有Node.js和Express.js的Docker

[英]Docker with Node.js and Express.js

我正在尝试将docker与节点应用程序一起使用,我的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-0.0.2.tgz后运行npm install后运行docker build之后,我得到一个错误:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM