After updating my @fastify/formbody plugin, I have encountered an error regarding a version mismatch:
FastifyError [Error]: fastify-plugin: @fastify/formbody - expected '^4.0.0' fastify version, '3.29.0' is installed
at Object.checkVersion (/Users/amargopastor/Projects/blog/node_modules/fastify/lib/pluginUtils.js:107:63)
at Object.registerPlugin (/Users/amargopastor/Projects/blog/node_modules/fastify/lib/pluginUtils.js:121:16)
at Boot.override (/Users/amargopastor/Projects/blog/node_modules/fastify/lib/pluginOverride.js:28:57)
at Plugin.exec (/Users/amargopastor/Projects/blog/node_modules/avvio/plugin.js:80:33)
at Boot.loadPlugin (/Users/amargopastor/Projects/blog/node_modules/avvio/plugin.js:274:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
statusCode: 500
}
The dependencies in my package.json file are as follows:
{
"name": "blog",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon src/server.ts",
},
"dependencies": {
"@fastify/formbody": "^7.0.0",
"fastify": "^3.29.0",
"nodemon": "^2.0.15",
"pino": "^7.6.3",
"pino-pretty": "^7.2.0",
"ts-node": "^10.8.0",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.2"
}
}
Below is the snippet of my code:
import fastify from "fastify";
import pino from "pino";
import { main_app } from "./app"
import { PORT } from "./config";
const server = fastify({
logger: pino({
name: "blog",
transport: {
target: "pino-pretty",
options: {
translateTime: true,
ignore: "time,pid,hostname,reqId",
colorize: true,
},
},
}),
disableRequestLogging: true,
});
server.register(main_app)
server.listen(PORT, "0.0.0.0");
import { FastifyPluginAsync } from "fastify";
import formBodyPlugin from "@fastify/formbody";
export const main_app: FastifyPluginAsync = async (app) => {
app.register(formBodyPlugin);
}
Has anyone else faced similar issues? It seems that there is no '^4.0.0' fastify version available.