FXAMN FXAMN - 3 months ago 55
Node.js Question

installation of nodejs returned a non-zero code: 1 with docker build

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!

Answer

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.