【问题标题】:Cannot find type definition file for 'cypress'.ts找不到“cypress”.ts 的类型定义文件
【发布时间】:2021-09-22 12:08:35
【问题描述】:

当尝试将 npm install -D cypress-xpath 安装到 Cypress 项目 [require('cypress-xpath') added to my cypress/support/index.js] 并安装了 cypress-cucumber-preprocessor 时,我得到了下面的插件错误 > "/// <reference types="cypress" />"的 index.js 文件?

找不到 'cypress'.ts(2688) 的类型定义文件

添加到插件> index.js 文件

const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}

package.json 文件

"devdependencies": {
    "cypress": "^8.3.1",
    "cypress-cucumber-preprocessor": "^4.2.0"
  },
  "Dependencies": {
    "cypress-xpath": "^1.6.2"
  }

支持 > index.js 文件

require('cypress-xpath')

运行时:

npx cypress open

插件文件丢失或无效。

您的 pluginsFile 设置为 C:\Users\Delwin\VSCode\Cypress\Cucumber1\cypress\plugins\index.js,但文件丢失、包含语法错误或在需要时抛出错误。 pluginsFile 必须是 .js、.ts 或 .coffee 文件。

或者您可能已经重命名了 pluginsFile 的扩展名。如果是这种情况,请重新启动测试运行程序。

如果您的项目不需要插件文件,请修复此问题,或将 pluginsFile 设置为 false。

错误:找不到模块“cypress-cucumber-preprocessor”

【问题讨论】:

    标签: xpath cypress cypress-cucumber-preprocessor


    【解决方案1】:

    我有同样的错误,我通过安装 cypress 修复了, https://docs.cypress.io/guides/getting-started/installing-cypress

    【讨论】:

      猜你喜欢
      • 2023-02-24
      • 2020-07-02
      • 2018-07-20
      • 2021-08-15
      • 2017-06-18
      • 2018-07-31
      • 1970-01-01
      • 2022-11-03
      • 2019-05-15
      相关资源
      最近更新 更多