Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM -bash command not found

Tags:

bash

node.js

npm

I am trying to run through nodeschool.io exercises. I am having trouble running their packages.

The first package I installed:

$ npm install -g learnyounode
$ learnyounode

Runs the package with the command learnyounode

Every other package on their site I tried installing and can't run the program with the proper command in the command line, ex:

$ npm install -g functional-javascript-workshop@latest
$ /Users/name/npm/bin/functional-javascript -> /Users/name/npm/lib/node_modules/functional-javascript-workshop/functional-javascript.js
/Users/name/npm/bin/functional-javascript-workshop -> /Users/name/npm/lib/node_modules/functional-javascript-workshop/functional-javascript.js
[email protected] /Users/name/npm/lib/node_modules/functional-javascript-workshop
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

$ functional-javascript-workshop
$ -bash: functional-javascript-workshop: command not found

Here is a link to the package I am trying to install in the example: functional-javascript-workshop

As you can see, I am getting the message -bash - command not found

Looking at other posts with similar problems, I ran the following commands to see my path and where the packages are being saved:

$ which node
$ /usr/local/bin/node

$ which npm
$ /usr/local/bin/npm

$PATH 
$ Users/name/.rbenv/shims:/Users/name/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: No such file or directory

Steps I tried:

  • Uninstall/Reinstall node using brew commands
  • global update npm's ($ npm update -g)

It looks like my node-modules are being installed at /Users/name/npm/lib/node_modules I'm not sure though how to give my command line access or a way of looking into that path for the command to start the program.

like image 856
HelloWorld Avatar asked Sep 30 '14 16:09

HelloWorld


People also ask

Why my npm command is not working?

On Windows, you may face the “npm command not found” error if the path to nodejs and npm are not added to your path variable. To fix this, locate the path to nodejs and npm binaries. The command above should add the specified directory to the path variable.

Where do I install npm?

NPM installs global packages into /<User>/local/lib/node_modules folder. Apply -g in the install command to install package globally.

How do I get npm in terminal?

To see if NPM is installed, type npm -v in Terminal. This should print the version number so you'll see something like this 1.4.


1 Answers

The functional-javascript-workshop executable is in /Users/name/npm/bin, which is not in your PATH variable, add this to your .bashrc or .bash_profile file:

export PATH=$PATH:/Users/name/npm/bin

Then you should be able to run functional-javascript-workshop

like image 60
jasonleonhard Avatar answered Sep 23 '22 20:09

jasonleonhard