javascript - 错误:使用 Parcel 运行 Cypress 时找不到绑定文件
问题描述
当我跑步时,cypress run --browser chrome
我得到:
The function exported by the plugins file threw an error.
We invoked the function exported by `C:\Users\LFOLMERT\projects\FE\signup\cypress\plugins\index.js`, but it threw an error.
Error: Could not locate the bindings file. Tried:
→ C:\Users\LFOLMERT\projects\FE\signup\node_modules\deasync\build\deasync.node
(...stack trace...)
at tryModuleLoad (module.js:466:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
为了修复它,我尝试了以下命令:
npm rebuild
yarn install --force
npm rebuild --update-binary
rm -rf node_modules && yarn install
rm -rf node_modules && npm install bindings && npm install
cd ./node_modules/deasync && node-gyp rebuild
./node_modules/.bin/electron-rebuild
他们都没有帮助,node-gyp 在deasync/build
目录中产生了一些东西,但再次运行 cypress 只会导致不同的错误。运行electron-rebuild
正在删除构建的文件。
我在 package.json 中的依赖项:
{
"dependencies": {
"babel": "^6.23.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-register": "^6.26.0",
"bindings": "^1.5.0",
"chai": "^4.2.0",
"cross-env": "^5.2.0",
"cypress": "^3.2.0",
"cypress-failed-log": "^2.4.2",
"cypress-parcel-preprocessor": "^1.0.0",
"electron-builder": "^20.39.0",
"electron-prebuilt": "^1.4.13",
"electron-rebuild": "^1.8.4",
"node-gyp": "^3.8.0",
"parcel-bundler": "^1.12.3"
},
}
我的柏树/插件/index.js:
module.exports = (on) => {
on('task', {
failed: require('cypress-failed-log/src/failed')(),
});
on('file', {
preprocessor: require('cypress-parcel-preprocessor')(),
});
};
解决方案
推荐阅读
- database - 什么时候应该在 MongoDB 中跳过 $and 运算符?
- windows - 我想在我的古老 Pavilion dv6 上重新安装 Windows 10
- docker - 使用 docker 运行 Redis master 和 sentinel 时出现问题
- reactjs - 在 React 中重构 JS 文件
- windows - 将 Powershell 的多个功能连接在一起
- entity-framework-core - 如何配置一对一关系以使外键也成为主键?
- javascript - Promise 对 Sequelize 和 Nodejs 的“解决”不起作用
- c# - 如何使它一次只能选择 1 个“能力”类型的对象?
- c# - 如何通过单击的预览项目制作相关项目的列表框?
- http - ServletResponse 的 setContentLength() 方法实际上是做什么的?