Redux-form-material-ui: 'mocha' command not found when npm install on the example

Created on 2 Feb 2017  Â·  10Comments  Â·  Source: erikras/redux-form-material-ui

Hi,

This is the error I get when I do npm install on the folder example.
'mocha' command is not found, do I need to install something ?

npm version : 4.1.2
node version : 6.9.1

C:\Users\Downloads\redux-form-material-ui-master\example>npm install
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm@4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> [email protected] prepublish C:\Users\Downloads\redux-form-material-ui-master
> npm run test && npm run lint && npm run clean && npm run build


> [email protected] test C:\Users\Downloads\redux-form-material-ui-master
> mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js

'mocha' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v6.9.1
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the redux-form-material-ui-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha --compilers js:babel-register --recursive --recursive "src/**/__tests__/*" --require src/__tests__/setup.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs redux-form-material-ui-test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls redux-form-material-ui-test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Downloads\redux-form-material-ui-master\npm-debug.log

npm ERR! addLocal Could not install C:\Users\Downloads\redux-form-material-ui-master
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.9.1
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] prepublish: `npm run test && npm run lint && npm run clean && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prepublish script 'npm run test && npm run lint && npm run clean && npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the redux-form-material-ui-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run test && npm run lint && npm run clean && npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs redux-form-material-ui-test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls redux-form-material-ui-test
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Downloads\redux-form-material-ui-master\example\npm-debug.log

C:\Users\Downloads\redux-form-material-ui-master\example>

Most helpful comment

try npm install -g mocha and then run the following commands

All 10 comments

try npm install -g mocha and then run the following commands

Not able to reproduce. I have just tried inside example and it works.

Thanks. It worked for me.

if you are on mac you have to use sudo npm install -g mocha

...why are you advising people to globally install packages? Wouldn't having mocha in devDependencies work just as well?

Wouldn't having mocha in devDependencies work just as well?

Mochajs.org says it should work.

I'm on windows 10 using git-bash:

npm install --save-dev mocha
mocha
bash: mocha: command not found

but:

npm install --global mocha
mocha


   simple fail
    1)  straight up fails 
    √  fails to fail 


  1 passing (14ms)
  1 failing

  1)  simple fail
        straight up fails :

      AssertionError [ERR_ASSERTION]: 0 == 1
      + expected - actual

      -0
      +1

      at Context.<anonymous> (test\roll.test.js:6:12)
      at processImmediate (internal/timers.js:439:21)

YAY!!!

I think mocha itself uses the global scope, so this is pretty on brand.

command npm test
for mocha I used--> npm install --global mocha

It is triggerring->
mocha --reporter spec "--host= --package=

but getting this error--> throw new Error(Unable to read/parse ${filepath}: ${err});

I tried using mvn clean install it worked for me, use clean

use npx mocha

use npx mocha

npm mocha worked for me, thanks

Was this page helpful?
0 / 5 - 0 ratings