Create a Single-Command Node.js CLI with Oclif, TypeScript and Yarn Workspaces

Share this video with your friends

Send Tweet

The fastest way to create a robust, cross-platform compatible Node.js CLI (optionally typed with TypeScript) is by running npx oclif single mycli. Here we explain what this means and how and why to integrate this with Yarn Workspaces for an ideal developer experience.

Pabba Anubharath
Pabba Anubharath
~ 5 years ago

Hi I get the below error

yarn workspace v1.12.3 yarn run v1.12.3 error Command "mycli" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed. Exit code: 1 Command: /usr/local/bin/node Arguments: /usr/local/Cellar/yarn/1.12.3/libexec/lib/cli.js mycli Directory: /Users/bharathpabba/Desktop/Project/Egg head workspaces/example Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.

Natalie Cyreus
Natalie Cyreus
~ 5 years ago

Pabba, It might be that you name the first folder the same as the one you create with oclif. Name it something else than the initial empty folder you created and I guess that should work. It did for me.

miktomic
miktomic
~ 4 years ago

I get the same problem as Pabba

Nicolas Terol
Nicolas Terol
~ 4 years ago

Thank you @Natalie for your explanations! package.json file with the workspace definition does not go inside the packages folder.