From e1243e6917410b96d4b6b52e802bc34b7f2399bd Mon Sep 17 00:00:00 2001 From: Loki <59907407+Loki-101@users.noreply.github.com> Date: Sun, 14 May 2023 14:08:37 -0700 Subject: [PATCH] Fix npm version compatibility The latest version of NPM for NodeJS 17 going off https://nodejs.org/en/download/releases is 8.11.0. Leaving it as @latest results in the following error during build: => ERROR [3/5] RUN npm install npm@latest--location=global 0.9s ------ > [3/5] RUN npm install npm@latest--location=global: #0 0.846 npm ERR! code EINVALIDTAGNAME #0 0.847 npm ERR! Invalid tag name "latest--location=global" of package "npm@latest--location=global": Tags may not have any characters that encodeURIComponent encodes. #0 0.849 #0 0.849 npm ERR! A complete log of this run can be found in: #0 0.849 npm ERR! /root/.npm/_logs/2023-05-14T21_06_16_353Z-debug-0.log ------ Dockerfile:9 -------------------- 7 | && useradd -m -d /home/container container 8 | 9 | >>> RUN npm install npm@latest--location=global 10 | 11 | USER container -------------------- ERROR: failed to solve: process "/bin/sh -c npm install npm@latest--location=global" did not complete successfully: exit code: 1 Additionally, there was a message during build about -g being depreciated and using --location=global instead, so I figured as long as I'm making a change to this anyways I may as well switch that out. With the first change it builds successfully, with the second change it builds successfully without the depreciation message. --- nodejs/17/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodejs/17/Dockerfile b/nodejs/17/Dockerfile index b9b4aa1b9..08d5c0716 100644 --- a/nodejs/17/Dockerfile +++ b/nodejs/17/Dockerfile @@ -6,7 +6,7 @@ RUN apt update \ && apt -y install ffmpeg iproute2 git sqlite3 libsqlite3-dev python3 python3-dev ca-certificates dnsutils tzdata zip tar curl build-essential libtool iputils-ping \ && useradd -m -d /home/container container -RUN npm install npm@latest -g +RUN npm install npm@8.11.0 --location=global USER container ENV USER=container HOME=/home/container