alphagov / govuk-prototype-kit

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

Cannot run migration script with prototypes that have not changed package name #1777

Closed lfdebrux closed 2 years ago

lfdebrux commented 2 years ago

Description of the issue

When running npx govuk-prototype-kit migrate in a prototype from v12 or older, users will likely get the following error:

npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npm-cache-test/_logs/2022-11-14T13_44_43_130Z-debug-0.log

Steps to reproduce the issue

  1. Create new v12 prototype from release archive
  2. Run npx govuk-prototype-kit migrate

Actual vs expected behaviour

Environment (where applicable)

lfdebrux commented 2 years ago

One workaround is to delete the package.json file before running the command, we could tell users to do this in our online instructions. Another alternative is to tell them to install the package globally first. Both of these feel a little icky though :(

Another possibility is adding a path option to the migrate script, so instead of telling them to change directory, we tell them to run the script in the containing folder. This might be hard to explain though, and could cause confusion...

lfdebrux commented 2 years ago

Found another potential workaround: running npx govuk-prototype-kit@latest version results in npx looking for the package online (tested with npm 8.19.2).

lfdebrux commented 2 years ago

Going to have a chat with @joelanman and @BenSurgisonGDS to check that we're happy to tell users to use the npx workaround, or another of the other workarounds, or to look for another solution.

lfdebrux commented 2 years ago

We've agree to tell users to npx govuk-prototype-kit@latest migrate. So we'll fix this issue in documentation.

We could also try npx govuk-prototype-kit@13 migrate, although currently we can't test this.

lfdebrux commented 2 years ago

I've updated the draft content in https://github.com/alphagov/govuk-prototype-kit/issues/1672, calling this ticket done.