Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm {package} --save-dev not running at the command line

Tags:

node.js

npm

i tried running

$npm install mocha --save-dev 

and then

$mocha

the result is

$-bash: mocha: command not found

If install it globally it works but what if I want to use a package version on this project only

Is there a way to make it works without installing it globally?

I am on a mac 10.11 el capitan

like image 225
Crimeira Avatar asked Feb 02 '17 11:02

Crimeira


2 Answers

You can use the npx command to run local dependencies

Try the command:

 npx mocha
like image 151
TheKnightCoder Avatar answered Sep 22 '22 07:09

TheKnightCoder


Since you haven't installed mocha globally you have to point terminal to your package's local directory

Run this command instead:

./node_modules/.bin/mocha

this will run the locally installed mocha package.

like image 27
Mrinmay Avatar answered Sep 20 '22 07:09

Mrinmay