Blitz: Add nicer error messages when using wrong CLI parameters

Created on 21 May 2020  Â·  4Comments  Â·  Source: blitz-js/blitz

What do you want and why?

Linux 4.19 | linux-x64 | Node: v13.14.0

blitz: 0.11.0 (global)

I was using blitz studio instead of blitz db studio and it returned the error below. It happens with whatever wrong CLI parameter you use after blitz.

(node:6705) TypeError Plugin: @blitzjs/cli: Cannot read property 'dim' of undefined
module: @oclif/[email protected]
task: runHook command_not_found
plugin: @blitzjs/cli
root: /home/lori/.npm-global/lib/node_modules/blitz/node_modules/@blitzjs/cli
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
 ›   Error: command studio not found

When using blitz db wrongParam it returns:

Uh oh, we don't support that command.
You can try running a prisma command directly with:

`npm run prisma COMMAND` or `yarn prisma COMMAND`

It might be nice to clean up these error messages?

good first issue kinbug scopcli statudone

Most helpful comment

Hm can’t reproduce this? For me it looked like this:

% blitz studio
You are using alpha software - if you have any problems, please open an issue here:
  https://github.com/blitz-js/blitz/issues/new/choose

 ›   Warning: studio is not a blitz command.
Did you mean start? [y/n]: 
 ›   Error: Run blitz help for a list of available commands.

All 4 comments

Yeah for sure!

I was unable to reproduce the first issue locally on my machine. Could it be OS specific?
This is my local config

macOS Mojave | darwin-x64 | Node: v13.14.0

blitz: 0.11.0 (global)
blitz: 0.11.0 (local)

I put up a PR to improve the output for the second issue

I'm getting the same error on Windows too.

Hm can’t reproduce this? For me it looked like this:

% blitz studio
You are using alpha software - if you have any problems, please open an issue here:
  https://github.com/blitz-js/blitz/issues/new/choose

 ›   Warning: studio is not a blitz command.
Did you mean start? [y/n]: 
 ›   Error: Run blitz help for a list of available commands.
Was this page helpful?
0 / 5 - 0 ratings