Skip to content

Commit aa9bb7f

Browse files
committed
Upgrade npm in Dockerfiles
Node 6 comes with npm 3 by default, which is (unsurprisingly) just as old and outdated as Node 6. It's so old that it doesn't understand package-lock.json, so the dependencies there were being totally ignored when deploying the application. (The only reason it might have appeared to work is if you had a node_modules folder that you'd created with a newer version of npm, which was being copied into the Docker container.) Thankfully, current versions of npm still support Node 6. When that changes it seems likely that we'll have to upgrade the version of Node we use.
1 parent bd3c725 commit aa9bb7f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ RUN \
77
apt-get update && \
88
apt-get install -y curl gnupg && \
99
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
10-
apt-get install -y nodejs=6.* build-essential
10+
apt-get install -y nodejs=6.* build-essential && \
11+
npm install -g npm
1112

1213
COPY package.json package-lock.json /app/
1314
RUN npm --prefix /app install

Dockerfile.dev

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ RUN \
88
apt-get update && \
99
apt-get install -y curl gnupg && \
1010
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
11-
apt-get install -y nodejs=6.* build-essential
11+
apt-get install -y nodejs=6.* build-essential && \
12+
npm install -g npm
1213

1314
COPY package.json package-lock.json /app/
1415
RUN npm --prefix /app install

0 commit comments

Comments
 (0)