graveyardjokes's avatar

npm not available after Herd install

So am I supposed to set the path variables after I install herd to use npm or composer? Herd did not set those up for me. I'm having trouble running npm specifically.

0 likes
5 replies
LaryAI's avatar
Level 58

When you install Herd, it should automatically set up the environment for you, including access to tools like npm. However, if npm is not available, it might be due to a path issue. Here’s how you can resolve it:

  1. Verify Herd Installation: First, ensure that Herd is installed correctly. You can do this by running:

    herd --version
    

    If this command doesn't work, you might need to reinstall Herd.

  2. Check Path Variables: If Herd is installed but npm is not recognized, you may need to manually add the path to your system's PATH environment variable.

    • On macOS/Linux:

      • Open your terminal and edit your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile).

      • Add the following line to include the path where Herd installs its binaries:

        export PATH="$PATH:$HOME/.herd/bin"
        
      • Save the file and run source ~/.bashrc or source ~/.zshrc to apply the changes.

    • On Windows:

      • Open the Start Search, type in "env", and select "Edit the system environment variables".
      • Click on "Environment Variables".
      • Under "System variables", find the Path variable and click "Edit".
      • Add the path to Herd's bin directory (e.g., C:\Users\YourUsername\.herd\bin).
      • Click OK to save the changes.
  3. Restart Your Terminal: After updating the PATH, close and reopen your terminal or command prompt to ensure the changes take effect.

  4. Verify npm Availability: Now, try running:

    npm --version
    

    This should display the version of npm, indicating that it is now available.

If you continue to experience issues, consider checking Herd's documentation or support forums for any specific setup instructions related to your operating system.

1 like
graveyardjokes's avatar

@LaryAI So after investigating I realized that I was using the terminal from the herd popup. I'm not sure why npm does not work there but it works in command prompt.

budiaramdhanrindi's avatar

@LaryAI for windows user, there is no folder .herd/bin. I got this experienced and I solved this problem.

  1. open Powershell run as administrator.
  2. run this Set-ExecutionPolicy RemoteSigned, then type Y.
  3. Then try again run npm -v.
  4. Restart Herd App (close & run again).
  5. Try again run npm -v from terminal that call from Herd.
Tray2's avatar

I bought a new Mac Mini, and all I had to do was install Herd, install the php, and node versions I wanted from the Herd settings (PHP, and Node tabs).

1 like
graveyardjokes's avatar

@Tray2 Okay, I'm not sure If I checked/unchecked something during installation. Found this site https://github.com/beyondcode/herd-community/issues/762

They are talking about having similar issues. CMD or Powershell work fine with Herd for me. It's just Windows terminal which is the issue. My problem with that (just a bit) is that Herd opens the terminal on the site's panel.

Please or to participate in this conversation.