docker javascript node.js yarnpkg

Install yarn in a docker container says missing dependency

I’m using the node:6.7.0 image as my docker container and then follow the installation guide for yarn

sudo apt-key adv --keyserver --recv D101F7899D41F3C3
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Then I do

apt-get update && apt-get install yarn

But at this point I get an error message which says

yarn : Depends: nodejs (>= 4.0.0) but it is not going to be installed

I’ve echoed node -v before the install and it also says 6.7.0

Anything that I’m missing?

robertklep is right – if you check the Dockerfile for Node you’ll see they install Node by downloading the TAR, not through APT. You can check this by running an interactive container:

> docker run -it node:6.7.0 bash
[email protected]:/# dpkg -s nodejs
dpkg-query: package 'nodejs' is not installed and no information is available

You can use NPM in your Dockerfile instead:

FROM node:6.7.0
RUN npm install -g yarn