Troubleshooting
daraja-local Is Not Recognized
Rebuild and relink:
npm run build
npm link
Then verify:
daraja-local --version
If it still fails, check npm’s global prefix:
npm prefix -g
Make sure that folder is in your PATH.
On this machine, npm reports:
C:\nvm4w\nodejs
Direct Built CLI Works But Global Command Does Not
Try:
node dist/src/cli/index.js --version
If this works, the project built correctly and the problem is the global link or PATH.
If this fails, rebuild:
npm run build
dist/src/cli/index.js Is Missing
Run:
npm run build
The package.json binary points to:
dist/src/cli/index.js
Port 8080 Is Already In Use
Use another port:
daraja-local start --port 9090
Then point CLI commands at it:
daraja-local transactions --base-url http://127.0.0.1:9090
Callback Is Not Received
Check:
- the
CallBackURLin your STK Push request is reachable from your machine - your app accepts
POST - your app accepts
Content-Type: application/json - no firewall or port conflict is blocking the callback server
Inspect the transaction:
daraja-local transactions
Look at callbackAttempts for status code or error details.
Transaction Cannot Be Approved After Failing
This is expected. Daraja Local enforces state transitions.
Create a new STK Push request if you need to test another outcome.
