Christopher Begley
Christopher Begley

Reputation: 111

Invalid configFile (Cypress 10.0) - cannot find module

I'm trying to convert my Cypress configFile to use with Cypress 10.0+

I've followed the new documentation, however Cypress is stating my file is invalid.

"Error: Cannot find module 'cypress'"

Here's the config I'm trying to use...

const { defineConfig } = require('cypress')

module.exports = defineConfig({
    e2e: {
        specPattern: "tests/e2e/**/*.cy.js",
        supportFile: "tests/support/e2e.js"
    },
    projectId: "zpk6q6",
    reporter: "junit",
    reporterOptions: {
        mochaFile: "tests/test-output-[hash].xml",
        toConsole: true,
        attachments: true
    }
})

Hopefully someone else in the Cypress community can assist me. Thanks in advance!

Upvotes: 5

Views: 20455

Answers (2)

Elgharbaouy Mohamed
Elgharbaouy Mohamed

Reputation: 1

Try this instead :

npm install cypress --save-dev --force

Upvotes: 0

Christopher Begley
Christopher Begley

Reputation: 111

I managed to solve this.

Before I run npx cypress run..., I needed to actually install Cypress. So my command looks like

npm install cypress --save-dev
npx cypress run --browser chrome

Upvotes: 6

Related Questions