0

我以前从未使用过docker。我创建了一个包含以下代码行的 docker 文件。

FROM cypress/base:14.19.0
RUN mkdir /legrande-cypress
WORKDIR /legrande-cypress
COPY ./package.json .
COPY ./cypress.json .
COPY ./cypress  ./cypress
RUN npm install
ENTRYPOINT ["npx","cypress","run"]

当我使用它运行 cypress 测试时,docker run -i -v "%cd%":/legrande-cypress -t cypress-image:latest --spec cypress/integration/examples/*.js它会在下面抛出一个错误。

Your pluginsFile threw an error from: /legrande-cypress/cypress/plugins/index.js


Error: Cannot find module 'cypress-mochawesome-reporter/plugin'

Require stack:

- /legrande-cypress/cypress/plugins/index.js

- /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js

- /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/index.js

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)

    at Function.Module._load (internal/modules/cjs/loader.js:746:27)

    at Module.require (internal/modules/cjs/loader.js:974:19)

    at require (internal/modules/cjs/helpers.js:101:18)

    at module.exports (/legrande-cypress/cypress/plugins/index.js:22:3)

    at /root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:94:12

    at tryCatcher (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)

    at Function.Promise.attempt.Promise.try (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)

    at load (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:91:7)

    at EventEmitter.<anonymous> (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:209:5)

    at EventEmitter.emit (events.js:400:28)

    at process.<anonymous> (/root/.cache/Cypress/9.5.1/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)

    at process.emit (events.js:400:28)

    at emit (internal/child_process.js:912:12)

    at processTicksAndRejections (internal/process/task_queues.js:83:21)

如何解决此错误,如果有人有任何想法,请告诉我。

4

0 回答 0