Ajay
Ajay

Reputation: 11

Cypress Error (Can't walk dependency graph: ENOENT: no such file or directory, lstat)

When I am trying to Run Cypress Test Runner following error is coming Can't walk dependency graph: ENOENT: no such file or directory, lstat

Cypress Version

Cypress package version: 9.5.1 Cypress binary version: 9.5.1 Electron version: 15.3.4 Bundled Node version: 16.5.0

Following are the configuration:-

  1. Package.json

{
  "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

{
  "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"
    }
  }
  }


Not able to Identify the issue

Upvotes: 1

Views: 7444

Answers (2)

user20358046
user20358046

Reputation: 9

In my case, while scripting below import gets added by mistake in auto suggestion in stepdefination file.

import { text } from "stream/consumers";

Remove this & script will work.

Upvotes: 0

Niluka Monnankulama
Niluka Monnankulama

Reputation: 375

Delete node_modules

Just delete package-lock.json file and then install packages you want with npm install . All will work.

rm -rf node_modules

rm package-lock.json

npm install

If the issue still persists check if you have a global version of any of the packages installed. This can happen if you have a global version of a package that clashes with a local version of a package.

And another thing, It may be a problem with the cache, try to verify the cache.

npm cache verify

If this due to npm cache problems. Run

npm install --cache /tmp/empty-cache

Upvotes: 0

Related Questions