govuk-prototype-kit icon indicating copy to clipboard operation
govuk-prototype-kit copied to clipboard

Running the kit using PowerShell / cmd gives an unhelpful error message

Open 36degrees opened this issue 3 years ago • 3 comments

Description of the issue

Raising as this has come up a couple of times on support recently. I don't have a Windows machine to test on myself, so am limited to what I've learned through support.

If a user tries to run the kit using Windows PowerShell it fails with an unhelpful error message:

PS C:\path\to\prototype> npm start
> [email protected] start
> node start
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\path\to\prototype
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I think the 'file' that can't be found in this instance is bash which nodemon is attempting to spawn.

See if there's a way to detect if the kit is being run in PowerShell / if bash isn't available, and give a more helpful error message which tells the user to use Git Bash instead.

Steps to reproduce the issue

Run the kit using Windows PowerShell

Actual vs expected behaviour

Actual behaviour: Very unhelpful error message ☹️ Expected / desired behaviour: A helpful error message 🙂

Environment (where applicable)

  • Operating system: Windows
  • Browser: N/A
  • Browser version: N/A
  • GOV.UK Prototype Kit version: 12.1.1

36degrees avatar Sep 05 '22 13:09 36degrees

The guidance on https://govuk-prototype-kit.herokuapp.com/docs/install/requirements.md could also be clearer that users must use Git Bash to run commands.

36degrees avatar Sep 05 '22 13:09 36degrees

I think we can actually remove the requirement for Bash on Windows, I've tried updating the tests to use PowerShell and cmd and they seem to pass: https://github.com/alphagov/govuk-prototype-kit/pull/1625.

This wouldn't necessarily mean we stop advising users to use Bash, but if they do run 'npm start' in PowerShell for some reason (through an IDE for example) they wouldn't get an error message and the kit would run as before.

lfdebrux avatar Sep 28 '22 10:09 lfdebrux

This issue will be resolved in release of v13.

lfdebrux avatar Sep 30 '22 09:09 lfdebrux