首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cypress错误(无法遍历依赖关系图: ENOENT:没有这样的文件或目录,lstat)

Cypress错误(无法遍历依赖关系图: ENOENT:没有这样的文件或目录,lstat)
EN

Stack Overflow用户
提问于 2022-03-10 05:44:01
回答 2查看 2.4K关注 0票数 0

当我试图运行Cypress测试运行器时,出现了以下错误:无法遍历依赖关系图: ENOENT:没有这样的文件或目录,lstat

Cypress版本

Cypress软件包版本: 9.5.1 Cypress二进制版本: 9.5.1电子版本: 15.3.4捆绑节点版本: 16.5.0

结构如下:

  1. Package.json

代码语言:javascript
复制
{
  "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
  }
}

  1. Cypress.json

代码语言:javascript
复制
{
  "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"
    }
  }
  }

无法确定问题

EN

回答 2

Stack Overflow用户

发布于 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

票数 0
EN

Stack Overflow用户

发布于 2022-10-28 11:59:15

在我的例子中,导入下面的脚本在自动建议中错误地添加到逐步定义文件中。

代码语言:javascript
复制
import { text } from "stream/consumers";

移除这个&脚本会工作的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71419358

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档