nodemon ''mocha' is not recognized as an internal or external command, operable program or batch file

前端 未结 8 742
被撕碎了的回忆
被撕碎了的回忆 2021-01-04 06:25

Running a test for a nodejs project on windows 10 with the line in package.json as:

\"test\": \"nodemon --exec \'mocha -R min\'\"

I get:

8条回答
  •  旧时难觅i
    2021-01-04 06:50

    An alternative approach is to add the mocha path to the environment variables then restart the bash On your editor, navigate to the bin folder of mocha and add both paths to your system environments. All script options that have been illustrated work with this approach

    "scripts": {
        "test": "nodemon --exec \"mocha -R min\""
    }
    

    or

    "scripts": {
        "test": "nodemon --exec 'mocha -R min'"
    }
    

    or

    "scripts": {
        "test": "nodemon --exec mocha -R min"
     }
    

    in the package.json file are correct dependencies definition

    I hope this helps fix the issue.

提交回复
热议问题