alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
305 stars 236 forks source link

kit can fail to run, with zlib errors #2405

Closed joelanman closed 7 months ago

joelanman commented 7 months ago

Description of the issue

A user is reporting this error, from the use of a 13 year old version of zlib https://github.com/kkaefer/DEPRECATED-node-zlib/issues/14

I've raised a PR to fix: https://github.com/alphagov/govuk-prototype-kit/pull/2404

As a workaround until the fix is merged you can fork or clone this starter repo instead: https://github.com/joelanman/govuk-prototype-kit-prototype

Another workaround is to try a different version of Node

joelanman commented 7 months ago

another user has had this issue - seems to be affecting Windows so far

Update - has been reported on Mac too

chrishylanduk commented 7 months ago

I ran into this too, on MacOS. https://github.com/joelanman/govuk-prototype-kit-prototype got me up and running, cheers @joelanman

TimothyFothergill commented 7 months ago

Just to add to this - It looks like this is affecting latest node minor versions - node version 18.20.0 it fails, however on version 18.19.0 it works - Same for 20.12.0 it fails but 20.11.0 succeeds. This issue is stopping the creation of new prototypes.

36degrees commented 7 months ago

Looks like this is caused by a change in npm v10.4.0 – I can get the same behaviour on node v20.11.0 by bumping npm:

~/Code/zlib-test via ⬢ v20.11.0 
➜ asdf local nodejs 20.11.0

~/Code/zlib-test via ⬢ v20.11.0 
➜ npm install -g npm@10.2.5   

removed 9 packages, and changed 46 packages in 3s

28 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...

~/Code/zlib-test via ⬢ v20.11.0 took 11s 
➜ rm -rf node_modules && npm install zlib

added 1 package, and audited 2 packages in 2s

found 0 vulnerabilities

~/Code/zlib-test via ⬢ v20.11.0 took 3s 
➜ npm install -g npm@10.3.0              

removed 11 packages, and changed 26 packages in 2s

24 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...

~/Code/zlib-test via ⬢ v20.11.0 took 10s 
➜ rm -rf node_modules && npm install zlib

added 1 package, and audited 2 packages in 1s

found 0 vulnerabilities

~/Code/zlib-test via ⬢ v20.11.0 took 2s 
➜ npm install -g npm@10.4.0              

removed 13 packages, and changed 28 packages in 2s

24 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...

~/Code/zlib-test via ⬢ v20.11.0 took 10s 
➜ rm -rf node_modules && 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

npm ERR! A complete log of this run can be found in: /Users/oliver.byford/.npm/_logs/2024-04-03T11_20_23_830Z-debug-0.log

I think we're seeing this with the latest minor versions of node only because they come with the newer npm version?

I would like to understand exactly what change in 10.4.0 has caused this issue but probably not worth sinking any more time into it.

Regardless, I think removing the dependency on zlib makes sense – will review #2404.

joelanman commented 7 months ago

yeh it's weird I can't see how it ever worked, given we are requiring that package, and it is too old and doesn't work

there is a wider bug - the npx govuk-prototype-kit create command is failing silently when this bug occurs, and it shouldn't. I wasn't sure if it was worth raising