alphagov / govuk-prototype-kit

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

Support no internet connection #2370

Closed BenSurgisonGDS closed 9 months ago

BenSurgisonGDS commented 9 months ago

This fixes the issue detected by a user as below:

This was detected by a user posting the following:

Environment:

OSX 12.6.9
npm -v 8.19.3
node -v v18.13.0

Error. Kit will not run with internet connection disabled.

Error message:

Node.js v18.13.0
[nodemon] For missing modules try running `npm install`
Restarting kit...

You can manage your prototype at:
http://localhost:3000/manage-prototype

The Prototype Kit is now running at:
http://localhost:3000/

/Users/ian/Sites/xd/node_modules/govuk-prototype-kit/lib/utils/index.js:273
  const [, latestMajor, latestMinor, latestPatch, latestSuffix] = latestVersion.match(matcher)
                                                                                ^

TypeError: Cannot read properties of undefined (reading 'match')
    at hasNewVersion (/Users/ian/Sites/xd/node_modules/govuk-prototype-kit/lib/utils/index.js:273:81)
    at refreshPackageInfo (/Users/ian/Sites/xd/node_modules/govuk-prototype-kit/lib/plugins/packages.js:122:85)
    at async Promise.all (index 0)
    at async startPackageTracker (/Users/ian/Sites/xd/node_modules/govuk-prototype-kit/lib/plugins/packages.js:24:3)

Node.js v18.13.0
[nodemon] For missing modules try running `npm install`