I’m experiencing an issue with the HubSpot CLI not operating correctly after I installed it using NPM. The installation appears to go smoothly without any errors, but I can’t utilize the CLI commands.
My attempts include:
NPM is set up - I have verified that NPM is functioning correctly on my machine.
Global installation of HubSpot CLI - I issued the command npm install -g @hubspot/cms-cli in the /usr/local/bin/ directory.
Command not found - When I attempt to execute hs init, I receive the message zsh: command not found: hs.
Empty package list - The output of npm list shows no packages installed.
Local installation tried - I tried to install it within my project directory; it indicates that HubSpot is installed but lists no further dependencies.
Persistent error - Even after the local installation, the hs init command still yields the same “command not found” error.
I feel like I might be overlooking something simple. Has anyone faced this challenge before? The installation seems straightforward, yet something isn’t functioning as it should.
This is a permission issue mixed with wrong install location. You can’t just install directly to /usr/local/bin/ - that’s not how npm global installs work. Run sudo npm install -g @hubspot/cms-cli from your home directory instead. You need sudo because npm needs write access to the global directory. Once it’s installed, check if it worked with which hs - this’ll show you where the hs command actually lives. If you’re still hitting permission errors, consider setting up npm to use a different directory for global packages so you don’t need sudo every time.
Had this exact problem before. Your global npm path isn’t in your system’s PATH variable. Run npm config get prefix to see where your global packages are stored. Make sure the bin directory (usually /usr/local/bin) is in your PATH. Check with echo $PATH. If it’s missing, add it to your shell config file (.zshrc or .bash_profile). Then restart your terminal or run source ~/.zshrc. That’ll fix the command not found error.
Try npx @hubspot/cms-cli init instead of hs init. Sometimes the global install doesn’t set up the command alias right, but npx will find it. If that works, you’ll know the package is installed but just not linked properly.