NOTE: It's not a question, it's sharing of todays headache, hopefully it will save somebody some time.
Our builds started to fail with the error
#29 [22/27] RUN npm install
#29 1.031 npm ERR! Invalid Version: ^4.2.4
#29 1.033
#29 1.033 npm ERR! A complete log of this run can be found in:
#29 1.034 npm ERR! /root/.npm/_logs/2023-06-14T13_07_01_675Z-debug-0.log
#29 ERROR: executor failed running [/bin/sh -c npm install]: exit code: 1
Today's (Jun 14, 2023) update for the php:8.1-fpm
included upgrade for Debian which installs nodejs v18 and npm v9.2. However our node packages where prepared with nodejs v12 and npm v7.5 the versions installed with previous Debian
After short investigate I found out that the error occurs on the following package.json entries
"scripts": { "preinstall": "npx npm-force-resolutions" }, "resolutions": { "graceful-fs": "^4.2.4" }
After several unsuccessful tries to downgrade nodejs and npm I finally came up to a decision to install previous build of php:8.1-fpm
by changing the Dockerfile
from
FROM php:8.1-fpm
to
FROM php:8.1-fpm@sha256:f884993fb0965ebdf6e3b7111f01738e5f1b0f143bcabba72de0f99aed07e668
Adjusting of package.json
and package.lock
to nodejs 18 andor npm 9.2 to be done ASAP.