How does “npm” run “npm test”?

You may have two versions of mocha installed: one globally (npm install -g mocha) and one locally, which appears to be broken.

When you run a script through npm, either as npm run-script <name> or with a defined shortcut like npm test or npm start, your current package directory’s bin directory is placed at the front of your path. For your package that’s probably ./node_modules/.bin/, which contains a link to your package’s mocha executable script.

You can probably fix this by removing the local mocha and reinstalling it with –save-dev:

rm -rf node_modules/mocha
npm install --save-dev mocha

That should get you a working local copy of mocha with all its dependencies (commander etc.) installed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)