Install and Link the CLI

Use this guide when developing Daraja Local from this local folder.

1. Install Dependencies

From the project root:

npm install

2. Build the CLI

The linked CLI runs the compiled JavaScript in dist, so build before linking:

npm run build
npm link

This should make the daraja-local command available in your terminal.

daraja-local --version

Expected output:

0.1.0

5. If daraja-local Is Not Found

First confirm npm knows the package is linked:

npm list -g --depth=0

You should see:

daraja-local@0.1.0 -> C:\alex\daraja-local

Then confirm your npm global prefix:

npm prefix -g

On this machine it is currently:

C:\nvm4w\nodejs

Make sure that folder is in your PATH. In PowerShell:

$env:Path -split ';' | Select-String -SimpleMatch 'C:\nvm4w\nodejs'

If the path is present but the command is still missing, rebuild and relink:

npm run build
npm link

You can always run the CLI directly through npm:

npm run dev

Or after building:

npm start

For one-off commands against the built CLI:

node dist/src/cli/index.js --version
node dist/src/cli/index.js transactions
npm unlink -g daraja-local