1

Using a Mac Os X Yosemite was trying generate some scaffolding and this is what comes back in the bash terminal

-bash: some_command: not found

This happens with most of my commands like run, serve etc when trying to generate or use certain executable commands. General alias’s and commands like mv, ls, rm etc work fine

I’ve checked my $PATH and it seems correct:

$ /bin/echo $PATH /Users/user_name/.rbenv/shims:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/Users/user_name/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin

I checked to make certain npm, node, yomen, grunt etc show as installed with -v and shows updated and installed.

I’ve checked my ~.bash_profile appears and aliases but all seems fine.

The best I can gage is it has something to do possibly with npm and or Node and possibly Homebrew. So I’ve uninstalled, reinstalled and researched any similar like questions out there but nothing seems to work. Hoping someone can point me in the right direction here since I am at a lost. And I am not the best at the environment set up. So might not be looking at something thats staring at me in the face. Thanks in advance.

9
  • 1
    So, whatever these mysterious commands you cannot execute are called (run and serve, perhaps?), where are they located along your PATH? A statement such as I’ve checked my $PATH and it seems correct can only be reasonable if you've verified that these commands are in one of the directories specified in PATH. Commented Dec 9, 2015 at 17:19
  • Hi I am sorry ask this but how might I verify that. I certainly am not 100% clear on this part. Commented Dec 9, 2015 at 17:31
  • What command are you trying to run, and does it appear in any directory listed in PATH? For instance, if you are trying to run foobar, then does /Users/user_name/.rbenv/shims/foobar exist? Does /usr/local/opt/coreutils/libexec/gnubin/foobar exist? etc. Commented Dec 9, 2015 at 17:32
  • Example I was trying to localhost docpad with docpad run or I try to create an Angular app with Yomen by typing Yo Angular. All show bash: command not found. Commented Dec 9, 2015 at 17:42
  • Are you sure you even installed yeoman, for example? npm install -g yo Commented Dec 9, 2015 at 17:52

1 Answer 1

1

Make sure to install whatever CLI tool you're trying to use first if you haven't already. For example:

npm install -g yo

That command installs yeoman into the global npm module directory. That directory should also be in your $PATH. To find the directory npm uses, type the following:

npm config get prefix

That will show you what directory npm is installing global modules to. In that directory there should be a bin/ directory with symlinks for any CLI tools that came with a global module you installed. That bin/ directory should be in your $PATH variable for bash to find command line scripts in there.

I'm using NVM to manage my node installations so when I run npm config get prefix my directory is: /Users/chev/.nvm/versions/node/v5.0.0. That's not the standard directory though. If you installed node with the default installer then yours will be different. When I do echo $PATH mine looks like this: /Users/chev/.nvm/versions/node/v5.0.0/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin. Directories in path are separated by colons (:).

A common problem with node on OSX is the need to use sudo with npm commands because of permissions issues in the default global npm modules directory. If you're having issues like that I suggest you also start using something like NVM. NVM allows you to install multiple node versions side by side, but even if you don't need that functionality it's still useful because it configures node & npm so that everything operates out of your home directory at ~/.nvm/ and avoids permission issues. No more sudo.

Sign up to request clarification or add additional context in comments.

8 Comments

I believe it was installed thru Homewbrew and from what I read the sudo is highly reccommended against using, since it somehow conflicts with how it works. I now it worked for months until last week and somehow jsut stopped working
This is my path when I do echo $PATH /Users/aronfrenz/.rbenv/shims:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/Users/aronfrenz/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
So did you check your npm prefix or not? Telling me your $PATH tells me nothing if I don't know your npm prefix. I'm not sure if you misread my answer or what, but I am also telling you not to use sudo if you are.
$ npm config get prefix /Users/aronfrenz/.node
that's it! THANK YOU! And thanks to everyone else as well. This is my first time around with this type of issue and very appreciative of the help and guidance.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.