Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing Webpack Compilation Error #17105

Closed
swasthik08 opened this issue Jun 24, 2021 · 4 comments
Closed

Facing Webpack Compilation Error #17105

swasthik08 opened this issue Jun 24, 2021 · 4 comments

Comments

@swasthik08
Copy link

swasthik08 commented Jun 24, 2021

Getting Web Compilation error, can someone help me to resolve this

Cypress version -7.6.0

Error: Webpack Compilation Error
./cypress/integration/examples/Practice/practice1.js
Module not found: Error: Can't resolve 'cypress/types/lodash' in '/Users/swasthik/CypressAutomation/cypress/integration/examples/Practice'
resolve 'cypress/types/lodash' in '/Users/swasthik/CypressAutomation/cypress/integration/examples/Practice'
  Parsed request is a module
  using description file: /Users/swasthik/CypressAutomation/package.json (relative path: ./cypress/integration/examples/Practice)
    Field 'browser' doesn't contain a valid alias configuration
    Looked for and couldn't find the file at the following paths:
[/Users/swasthik/CypressAutomation/cypress/integration/examples/Practice/node_modules]
[/Users/swasthik/CypressAutomation/cypress/integration/examples/node_modules]
[/Users/swasthik/CypressAutomation/cypress/integration/node_modules]
[/Users/swasthik/CypressAutomation/cypress/node_modules]
[/Users/swasthik/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash.js]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash.json]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash.jsx]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash.mjs]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash.coffee]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index.js]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index.json]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index.jsx]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index.mjs]
[/Users/swasthik/CypressAutomation/node_modules/cypress/types/lodash/index.coffee]

Screenshot 2021-06-24 at 9 17 36 PM

@jennifer-shehane
Copy link
Member

@swasthik08 Is this an error that began happening when you updating to 7.6.0 from some previous version? What version? Or was this a new project?

Can you provide the contents of the cypress/integration/examples/Practice/practice1.js file and your package.json file? Or any way to reproduce this on our end so we can investigate. Thanks.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jun 24, 2021
@swasthik08
Copy link
Author

swasthik08 commented Jun 24, 2021

package.json

{ "name": "cypressautomation", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "devDependencies": { "cypress": "^7.6.0" } }

practice.js--

///
const { includes } = require("cypress/types/lodash")
describe('My first test suite',function()
{
it('My first test case', function()
{
cy.visit('xyz')
cy.get('.search-keyword').type("ca")
cy.get('.product').should('have.length',5)
cy.get('.product:visible').should('have.length',4)
cy.get('div.products').find('.product').eq(2).contains('ADD TO CART').click()
cy.get('div.products').find('.product').each(($el, index, $list) => {
const vegtext = $el.get('product-name').text()

 if (vegtext.includes("cashews") ) 
 {
    cy.wrap($el.find('button')).click()
  } 

})})})

@jennifer-shehane

@swasthik08
Copy link
Author

@jennifer-shehane This got fixed by changing experimentalSourceRewriting":true

@jennifer-shehane
Copy link
Member

Closing as resolved.

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants