当我试图运行Cypress测试运行器时,出现了以下错误:无法遍历依赖关系图: ENOENT:没有这样的文件或目录,lstat
Cypress版本
Cypress软件包版本: 9.5.1 Cypress二进制版本: 9.5.1电子版本: 15.3.4捆绑节点版本: 16.5.0
结构如下:
{
"name": "cypressautomationproject",
"version": "1.0.0",
"main": "index.js",
"author": "",
"license": "ISC",
"devDependencies": {
"@types/cypress-cucumber-preprocessor": "^4.0.1",
"cypress": "^9.5.1",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-iframe": "^1.0.1",
"mocha": "^5.2.0",
"mochawesome": "^7.1.0"
},
"dependencies": {
"cucumber": "^7.0.0-rc.0",
"run": "^1.4.0",
"socket.io": "^4.4.1"
},
"description": "",
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
}
{
"defaultCommandTimeout": 6000,
"pageLoadTimeout": 20000,
"reporter":"mochawesome",
"modifyObstructiveCode": true,
"experimentalSourceRewriting":true,
"chromeWebSecurity": true,
"testFiles": ["**/*.feature","**/*.js"],
"projectId": "jyfuej",
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"cucumberJson": {
"generate": true,
"outputFolder": "cypress/cucumber-json",
"filePrefix": "",
"fileSuffix": ".cucumber"
}
}
}
无法确定问题
发布于 2022-03-10 05:57:52
删除node_modules
只需删除package-lock.json文件,然后使用npm install安装所需的软件包。一切都会成功的。
rm -rf node_modules
rm package-lock.json
npm install
如果问题仍然存在,请检查是否安装了任何软件包的全局版本。如果包的全局版本与包的本地版本发生冲突,则可能发生这种情况。
另一件事,它可能是一个问题的缓存,试图验证缓存。
npm cache verify
如果这是由于npm缓存问题造成的。跑
npm install --cache /tmp/empty-cache
发布于 2022-10-28 11:59:15
在我的例子中,导入下面的脚本在自动建议中错误地添加到逐步定义文件中。
import { text } from "stream/consumers";移除这个&脚本会工作的。
https://stackoverflow.com/questions/71419358
复制相似问题