cypress: Module not found: Error: Can't resolve '@cypress/xpath'
Current behavior
Followed instructions for installing @cypress/xpath included require('@cypress/xpath') in support file. Encountered error running tests in Electron (but browser isnt really relevent):
Error: Webpack Compilation Error
Module not found: Error: Can't resolve '@cypress/xpath'
Desired behavior
Update package.json in @cypress/xpath to export correctly
Test code to reproduce
- npm install -D @cypress/xpath
- add
require('@cypress/xpath');to support file - run tests
Cypress Version
10.6.0
Node version
v16.14.0
Operating System
macOS 12.6
Debug Logs
No response
Other
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17 (1 by maintainers)
I’m also facing the same issue, following steps in readme
I was able to resolve the issue by:
ran command npm install -D cypress-xpath
in the folder cypress/support/e2e at the top of the file typed require(‘cypress-xpath’);
and at the cypress/e2e in my test at the top I placed the following command /// <reference types="cypress-xpath" />
@jordanpowell88 Thank you for taking a look at this issue, the repo unfortunately is private. I can set up a minimal example if needed.
Examining the node packages installed though, in the package.json for @cypress/xpath
mainis set toscriptsandscriptsis not supplied in the package.