Node.JS in a docker PHP container
I am learning to use Laravel Broadcasting. For that reason, I need to install node in my PHP container. For the last 40 minutes to an hour, I have been trying to install that.
A few months ago, when I tried the following, it worked like a charm.
RUN curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.shRUN bash nodesource_setup.shRUN apt-get install nodejsRUN rm nodesource_setup.sh
But, what’s going on now? Why isn’t it working?
When I was trying the code above, I was facing the issue like below.
E: Could not open file /var/lib/apt/lists/deb.debian.org_debian_dists_buster_main_binary-amd64_Packages.diff_Index — open (2: No such file or directory)
So to overcome that, I tried to do like the following. And it started to work. :D
...
# Whatever you did in your PHP Dockerfile
# this was missing for some reason. Didn't require last time.
RUN apt-get install -y gnupg2# Removing /var/lib/apt/lists worked
RUN rm -rf /var/lib/apt/lists/ && curl -sL https://deb.nodesource.com/setup_10.x | bash -RUN apt-get install nodejs -y
...
That’s it.