Nowadays, I’ve been playing around with Netlify, mainly because their generous free plan is perfect for personal sites. Beyond just hosting your site, their serverless functions are a fantastic way to quickly build APIs or simple HTTP endpoints for tasks like webhooks.
All right, enough free marketing for Netlify—this isn’t a sponsored post 😁. One feature that caught my attention was the ability to develop, run, and test these functions locally using their CLI. Installation seemed straightforward: just install the package globally, and you’re good to go.
npm install -g netlify-cli
But of course, that wasn’t the case for me—because why would things go smoothly? I kept running into a Command Not Found
error every time I tried running netlify
command. After some digging (and learning from others’ experiences), I discovered the issue: it was my Git Bash setup. When I checked my npm global prefix with:
npm get prefix -g
I found it was set to C:\Program Files\Git\usr\local
The fix was simple: Just add this to my system’s PATH env. variable and boom! I can build and test Netlify functions locally!
I’ll keep sharing notes from my trial-and-error adventures for future me -and hopefully, for anyone else who might find them useful!