powershell - 'testcafe' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称
问题描述
我正在尝试运行 testcafe chrome tests/ -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 脚本部分。
看看这个问题:How to use package local installed in node_modules? 进行全面讨论。
推荐阅读
- datatable - Apex Wrapper 类中带有对象字段的小计和总计
- powershell - 在搜索中包含评论
- docker - Docker Swarm:在 Worker 节点上部署容器
- javascript - React Router Redux 总是显示第一条路由
- javascript - 数据库数组没有插入我的数据库有什么问题?
- javascript - 在js中添加带有编辑文本的新表格
- javascript - 如何删除 TypeScript 类型注释但保留格式?
- php - 先前插入的值在页面刷新时自动插入
- node.js - 节点模块 - aes256 - crypto.createHash 不是函数
- spring-boot - 使用表单数据上传 Spring Boot 文件?