installation of nodejs returned a non-zero code: 1

2019-07-28 22:10发布

I'm trying to build a docker image with the following dockerfile:

FROM         ubuntu:16.10

MAINTAINER   Fátima Alves

COPY         ./dist /myprogram/
WORKDIR      /myprogram


RUN          apt-get update          \
                                  && \
             apt-get install -y      \
               curl                  \
                                  && \
             curl -sL https://deb.nodesource.com/setup_6.x | bash - \
                                  && \
             apt-get install -y      \
               python-dev            \
               libxml2-dev           \
               libxslt1-dev

And no matter what i do, this message is appearing in the terminal:

curl -sL https://deb.nodesource.com/setup_6.x | bash -' returned a non-zero code: 1

I'm not finding anything related in google.

Thanks!

2条回答
smile是对你的礼貌
2楼-- · 2019-07-28 22:36

It's DNS issue you can solve it by using the following steps:

1) Find your DNS ip using below command nmcli dev show | grep 'IP4.DNS'

IP4.DNS[1]: 192.168.0.1

2) Create a file in the desktop which name is deamon.json and file has below data: { "dns": ["192.168.0.1", "8.8.8.8"] }

note: replace that ip "192.168.0.1" to your dns ip

3) Go that directory /etc/docker/ in your system and paste file deamon.json that you just created

4) Then restart your docker/your system, it will solve your issue.

查看更多
时光不老,我们不散
3楼-- · 2019-07-28 22:55

Have you tried running this yourself to see what the error is? Like so:

$ docker run --rm -it ubuntu:16.10
[...]
root@96117efa0948:/# apt-get update
[...]
root@96117efa0948:/# apt-get install -y curl
[...]
root@96117efa0948:/# curl -sL https://deb.nodesource.com/setup_6.x | bash -
[...]
## Your distribution, identified as "Ubuntu Yakkety Yak (development 
branch)", is a pre-release version of Ubuntu. NodeSource does not maintain 
official support for Ubuntu versions until they are formally released. You 
can try using the manual installation instructions available at 
https://github.com/nodesource/distributions and use the latest supported 
Ubuntu version name as the distribution identifier, although this is not 
guaranteed to work.
root@96117efa0948:/#

So basically that blurb is telling you that your version of Ubunutu isn't supported yet. Try changing your config file to use ubuntu:16.04 - or work out some other way to install node.

查看更多
登录 后发表回答