我正在尝试运行testcafe chrome测试/-e以执行我的测试,但是会引发错误消息

"testcafe: The term 'testcafe' 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
+ testcafe chrome tests/ -e
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (testcafe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException"

added testcafe locally to project

我正在使用Visual Studio Code作为IDE和PowerShell终端来执行命令

最佳答案

本地安装的软件包不会自动添加到搜索路径。现代npm具有npx命令。

npx testcafe chrome tests/ -e

应该做你需要的。

另外,您可以将命令添加为npm脚本部分suggested in the documentation

看一下这个问题:How to use package installed locally in node_modules?进行完整讨论。

关于powershell - 无法将“testcafe”识别为cmdlet,函数,脚本文件或可运行程序的名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57653578/

10-12 20:53