cypress: 11.0.0 `cypress run` -> `Error: Cannot find module 'mocha-7.0.1'`

Current behavior

When I upgraded to 11.0.0, I ran cypress run as usual, and I got an error Error: Cannot find module 'mocha-7.0.1'

Desired behavior

No response

Test code to reproduce

const { defineConfig } = require(‘cypress’)

module.exports = defineConfig({ reporter: ‘mochawesome’, reporterOptions: { reportDir: ‘cypress/results’, overwrite: false, html: false, json: true } })

Cypress Version

11.0.0

Node version

v16.18.0

Operating System

macOS 13.0

Debug Logs

[1] Error loading the reporter: mochawesome
[1] 
[1] We searched for the reporter in these paths:
[1] 
[1]  - /Users/xxx/project/mochawesome
[1]  - /Users/xxx/project/node_modules/mochawesome
[1] 
[1] Learn more at https://on.cypress.io/reporters
[1] 
[1] Error: Cannot find module 'mocha-7.0.1'
[1] Require stack:
[1] - /Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js
[1]     at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
[1]     at n._resolveFilename (node:electron/js2c/browser_init:249:1105)
[1]     at PackherdModuleLoader._tryResolveFilename (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/packherd-require/dist/loader.js:645:32)
[1]     at PackherdModuleLoader._resolvePaths (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/packherd-require/dist/loader.js:491:31)
[1]     at PackherdModuleLoader.tryResolve (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/packherd-require/dist/loader.js:313:40)
[1]     at resolve (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/packherd-require/dist/require.js:125:33)
[1]     at require.resolve (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/v8-snapshot-require/dist/snapshot-require.js:216:28)
[1]     at customRequire.resolve (<embedded>:2809:961257)
[1]     at <embedded>:2755:13102
[1]     at i._load (<embedded>:2750:54101)
[1]     at Module.require (node:internal/modules/cjs/loader:1012:19)
[1]     at require (node:internal/modules/cjs/helpers:102:18)
[1]     at Object.<anonymous> (/Users/xxx/project/node_modules/.pnpm/mochawesome@7.1.3_mocha@10.1.0/node_modules/mochawesome/src/mochawesome.js:1:14)
[1]     at Module._compile (node:internal/modules/cjs/loader:1120:14)
[1]     at Module._extensions..js (node:internal/modules/cjs/loader:1175:10)
[1]     at Module.load (node:internal/modules/cjs/loader:988:32)
[1]     at Module._load (node:internal/modules/cjs/loader:829:12)
[1]     at c._load [as origLoad] (node:electron/js2c/asar_bundle:5:13339)
[1]     at PackherdModuleLoader.tryLoad (/Users/xxx/Library/Caches/Cypress/11.0.0/Cypress.app/Contents/Resources/app/packages/packherd-require/dist/loader.js:432:30)
[1]     at customRequire (<embedded>:2809:960157)
[1]     at S.loadReporter (<embedded>:2755:19452)
[1]     at P.initializeReporter (<embedded>:2802:336581)
[1]     at P.startWebsockets (<embedded>:2802:336891)
[1]     at P.open (<embedded>:2802:335033)
[1]     at async v.create (<embedded>:2802:347432)
[1]     at async O (<embedded>:2802:421364)
[1]     at async W (<embedded>:2802:432780)

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 15
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Released in 11.0.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v11.0.1, please open a new issue.

We are actively investigating the issue.

we also have the same issue after cypress updated to 11.0.0. Our configuration is the same as mentioned in the description.

I have same issue

Same issue here, we didn’t change anything in our configuration. The pipeline started our cypress run for the first time with version 11 and we have the same error.

Locally I was still on version 10 of cypress -> no problems there Updated locally to version 11 -> same problem

We use ‘cypress-multi-reports’:

reporter: 'cypress-multi-reporters',
  reporterOptions: {
    reporterEnabled: 'mocha-junit-reporter',
    mochaJunitReporterReporterOptions: {
      mochaFile: 'reports/cypress/xml/e2e-test-results-[hash].xml',
    },
  },