Skip to content

Commit

Permalink
remove zlib in favour of built in
Browse files Browse the repository at this point in the history
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]: kkaefer/DEPRECATED-node-zlib#7

Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
  • Loading branch information
joelanman and 36degrees committed Apr 3, 2024
1 parent 7060f23 commit 9e66db4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
17 changes: 1 addition & 16 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9e66db4

Please sign in to comment.