Windows 10更新后无法识别摩卡咖啡

时间:2020-09-25 18:03:57

标签: windows npm mocha

在安装了最新的Windows 10更新后,我不再能够运行Mocha。不能回滚更新。这是我得到的错误:

mocha : The term 'mocha' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mocha .\mascusToCdhTransformationServiceTest.js
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (mocha:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我尝试重新安装我的npm应用程序。我注意到它无法识别我的python安装。我通过运行来解决了

npm install --global --production windows-build-tools

我还尝试了

的几种变体
npm install mocha
npm install mocha -g
npm uninstall
npm install

一切似乎都成功了,但我仍然收到Windows无法识别摩卡的错误。我可以做些什么使Windows重新运行mocha?

1 个答案:

答案 0 :(得分:0)

我必须将〜\ AppData \ Roaming \ npm添加到我的环境路径变量中。我不确定为什么将其删除,但是重新添加即可解决该问题。