From 9e66db460356b69b1338024b174adfbb21462c91 Mon Sep 17 00:00:00 2001 From: Joe Lanman Date: Wed, 20 Mar 2024 13:23:36 +0000 Subject: [PATCH 1/2] remove zlib in favour of built in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creating new prototypes is (silently) failing when using npm v10.4.0 or newer because of an error that occurs when installing the `zlib` package: ``` $ npm install zlib npm ERR! code 127 npm ERR! path /Users/oliver.byford/Code/zlib-test/node_modules/zlib npm ERR! command failed npm ERR! command sh -c node-waf clean || true; node-waf configure build npm ERR! sh: node-waf: command not found npm ERR! sh: node-waf: command not found ``` The `zlib` package is 13 years old, and has been replaced by a zlib ‘core module’ built into node itself since Node v0.6. `require(‘zlib’)` will always return the core module [1] over a dependency from `node_modules`, and so despite being listed as a dependency the `zlib` package will never be used [2] and can safely be removed. [1]: https://nodejs.org/api/modules.html#modules_all_together [2]: https://github.com/kkaefer/DEPRECATED-node-zlib/issues/7 Co-authored-by: Oliver Byford --- npm-shrinkwrap.json | 17 +---------------- package.json | 3 +-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f4cbad01df..f2aa4fed17 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -32,8 +32,7 @@ "sync-request": "^6.1.0", "tar-stream": "^3.1.7", "universal-analytics": "^0.5.3", - "uuid": "^9.0.1", - "zlib": "^1.0.5" + "uuid": "^9.0.1" }, "bin": { "govuk-prototype-kit": "bin/cli" @@ -11835,15 +11834,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/zlib": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz", - "integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==", - "hasInstallScript": true, - "engines": { - "node": ">=0.2.0" - } } }, "dependencies": { @@ -20586,11 +20576,6 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true - }, - "zlib": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz", - "integrity": "sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==" } } } diff --git a/package.json b/package.json index 3daf1dc713..98602ec24e 100644 --- a/package.json +++ b/package.json @@ -84,8 +84,7 @@ "sync-request": "^6.1.0", "tar-stream": "^3.1.7", "universal-analytics": "^0.5.3", - "uuid": "^9.0.1", - "zlib": "^1.0.5" + "uuid": "^9.0.1" }, "devDependencies": { "cheerio": "^1.0.0-rc.12", From 58f2711e92e7e63920a0da190183b79c9ea4b22e Mon Sep 17 00:00:00 2001 From: Joe Lanman Date: Wed, 20 Mar 2024 15:48:47 +0000 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0874e32f1..d2452b2a89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- [#2404: Fix issues creating prototypes when using npm v10.4.0 or newer by removing dependency on zlib](https://github.com/alphagov/govuk-prototype-kit/pull/2404) + ## 13.16.1 ### Fixes