首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取FastifyError [错误]:fastify-plugin: fastify -静态-预期的'3.x‘fastify版本,'4.2.1’是安装错误

获取FastifyError [错误]:fastify-plugin: fastify -静态-预期的'3.x‘fastify版本,'4.2.1’是安装错误
EN

Stack Overflow用户
提问于 2022-07-20 11:25:50
回答 1查看 118关注 0票数 0

我尝试升级以优化v4,并得到了以下错误:

代码语言:javascript
复制
FastifyError [Error]: fastify-plugin: fastify-static - expected '3.x' fastify version, '4.2.1' is installed
     at Object.checkVersion (/var/www/node_modules/fastify/lib/pluginUtils.js:118:11)
     at Object.registerPlugin (/var/www/node_modules/fastify/lib/pluginUtils.js:133:16)
     at Boot.override (/var/www/node_modules/fastify/lib/pluginOverride.js:28:57)
     at Plugin.exec (/var/www/node_modules/avvio/plugin.js:79:33)
     at Boot.loadPlugin (/var/www/node_modules/avvio/plugin.js:272:10)
     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
   code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
   statusCode: 500
 }

我尝试将@fastify/static依赖项添加到6.4.0版本中,但这并没有帮助。知道我该怎么解决这个问题吗?

这些是我在使用fastify v3的项目中的当前依赖项:

代码语言:javascript
复制
"dependencies": {
    "@fastify/swagger": "^6.1.0",
    "axios": "^0.27.2",
    "deepmerge": "^4.2.2",
    "dotenv": "^16.0.0",
    "express": "^4.18.1",
    "fastify": "^3.29.0",
    "fastify-decorators": "3.12.0",
    "http-status-codes": "2.2.0",
    "jwt-decode": "3.1.2",
    "node-mocks-http": "^1.11.0",
    "nodemon": "^2.0.16",
    "qs": "^6.10.3",
    "ts-node": "^10.7.0",
    "winston": "^3.7.2",
    "winston-daily-rotate-file": "^4.7.1"
  },
  "devDependencies": {
    "@fastify/redis": "^5.0.0",
    "@tsconfig/node16-strictest-esm": "^1.0.2",
    "@types/jest": "^27.5.2",
    "@types/node": "^17.0.27",
    "@types/qs": "^6.9.7",
    "@typescript-eslint/eslint-plugin": "^5.22.0",
    "@typescript-eslint/parser": "^5.22.0",
    "eslint": "^8.17.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-config-typescript": "^3.0.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-n": "^15.2.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-promise": "^6.0.0",
    "jest": "^28.1.0",
    "prettier": "^2.6.2",
    "ts-jest": "^28.0.5",
    "typescript": "^4.6.4"
  }

基本上,我只是将fastify的版本更新为4.2.1,尝试了一下,得到了这个错误,还尝试添加了上面提到的@fastify/static依赖项,这也没有解决这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-20 16:46:32

您没有更新@fastify/swagger。您需要将@ Fastify /swagger更新为v7.x以支持Fastify v4.x。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73050802

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档