Error: Can't walk dependency graph: Cannot find module
See original GitHub issueCurrent behavior
I am trying to setup cypress-cucumber-preprocessor in my project. Cypress + React + Typescript
I have it all working as expected but when I try and setup cypress-cucumber-preprocessor with typescript I get the following error Error: Can't walk dependency graph: Cannot find module '^cypress/lib/auth.helper'
This happens with any custom module aliases used in my cypress files.
Here is my plugin index file:
const browserify = require('@cypress/browserify-preprocessor')
const cucumber = require('cypress-cucumber-preprocessor').default
const resolve = require('resolve')
module.exports = (on, config) => {
const options = {
...browserify.defaultOptions,
typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
}
on('file:preprocessor', cucumber(options))
}
Below is my tsconfig.json file in cypress directory
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "es6",
"lib": ["es6", "dom"],
"types": ["cypress"],
"isolatedModules": false,
"allowJs": true,
"noEmit": true,
"baseUrl": "..",
"paths": {
"^cypress": [
"../cypress/*"
]
}
},
"include": [
"../node_modules/cypress",
"**/*.ts"
],
"exclude": [],
}
Below is my tsconfig file at root
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"allowSyntheticDefaultImports": true,
"sourceMap": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false,
"preserveConstEnums": true,
"typeRoots": [
"./node_modules/@types"
],
"rootDirs": ["src/__generated__", "src/**/__generated__"],
"baseUrl": ".",
"paths": {
"@static/*": [
"./public/static/*"
],
"@generated/*": [
"./src/__generated__/*"
],
"@*": [
"./src/*"
]
}
},
"include": [
"src",
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"next.config.js",
"public",
"cypress",
"jest.setup.js",
"release.config.js"
],
"exclude": [
"node_modules",
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.graphql",
"cache/Cypress/**"
]
}
I've tried different examples with typescript and tsify but they did not work as well and got same issue.
Desired behavior
I would like to get the cypress-cucumber-preprocessor working with typescript in my current project.
Test code to reproduce
The code is a bit large but will try and provide a minimal working clone.
Versions
- Cypress version: 6.8.0
- Preprocessor version: 4.0.3
- Node version:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:32 (7 by maintainers)
Top Results From Across the Web
Can't walk dependency graph - Stack Overflow
I had the same error. This error means that it cannot find the required js file. Make sure that the file is in...
Read more >cypress-io/cypress - Gitter
cypress is showing below error messager after adding Drag and Drop plugin index.js and package.json file. Error: Can't walk dependency graph: Cannot find...
Read more >Error: Can't walk dependency graph: Cannot find module
Current behavior. I am trying to setup cypress-cucumber-preprocessor in my project. Cypress + React + Typescript.
Read more >Can't walk dependency graph: Cannot find module 'jquery' from
【node打包缺包】Error: Can't walk dependency graph: Cannot find module 'jquery' from.
Read more >Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue here, cannot get Typescript’s “baseUrl” or “alias” honoured by the browserify pre-processor, with the setup described in this project. See reproduction repo here: https://github.com/yann-combarnous/cypress-cucumber-ts-baseurl
What worked for me (cypress + cucumber + typescript + webpack5) Webpack file
plugins/index.js