alphagov / govuk-prototype-kit

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

Could the error if you try to run npm run dev without having run npm install be improved? #2288

Open oscarduignan opened 1 year ago

oscarduignan commented 1 year ago

Context

When someone tries to run npm run dev without having run npm install they see an error like this:

$ npm run dev
> dev
> govuk-prototype-kit dev
'govuk-prototype-kit' is not recognized as an internal or external command,
operable program or batch file.

Would it be possible for the dev script to check to let the user know if they might need to run npm install?

What I mean is something like

{
  "scripts": {
    "dev": "npm run check-if-npm-install-has-been-run && govuk-prototype-kit dev"
  }
}

Alternatives

guess there might be other ways to inform user to remember to run npm install

Additional information (if applicable)

N/A

frankieroberto commented 1 year ago

I like this idea. It'd especially benefit people to try to run prototypes created by other people. The error can be quite cryptic, depending on what’s previously been installed.

It might even be better to actually run npm install every time that npm run dev is run? It adds a small time delay overhead, but on my machine at least it's less than a second if everything is installed already.