I am trying to use @fastify/oauth2 and cannot get past a package dependency problem.
The current package.json is:
{
"name": "glitch-hello-node",
"version": "0.1.0",
"description": "A simple Node app built on fastify, instantly up and running. Built to be remixed on Glitch.com.",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"fastify": "^5.1.0",
"handlebars": "^4.7.8",
"@fastify/formbody": "^8.0.1",
"@fastify/static": "^8.0.2",
"@fastify/view": "^10.0.1",
"@fastify/oauth2": "^8.1.0"
},
"engines": {
"node": "14.x"
},
"repository": {
"url": "https://glitch.com/edit/#!/glitch-hello-node"
},
"license": "MIT",
"keywords": [
"node",
"glitch"
]
}
This is the compile error log:
/rbd/pnpm-volume/b276dc1f-5164-4cb6-81fb-861fd6d5ebb0/node_modules/fastify/lib/wrapThenable.js:9
5:59 PM
const channels = diagnostics.tracingChannel('fastify.request.handler')
5:59 PM
^
5:59 PM
5:59 PM
TypeError: diagnostics.tracingChannel is not a function
5:59 PM
at Object.<anonymous> (/rbd/pnpm-volume/b276dc1f-5164-4cb6-81fb-861fd6d5ebb0/node_modules/fastify/lib/wrapThenable.js:9:30)
5:59 PM
at Module._compile (internal/modules/cjs/loader.js:1085:14)
5:59 PM
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
5:59 PM
at Module.load (internal/modules/cjs/loader.js:950:32)
5:59 PM
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
5:59 PM
at Module.require (internal/modules/cjs/loader.js:974:19)
5:59 PM
at require (internal/modules/cjs/helpers.js:101:18)
5:59 PM
at Object.<anonymous> (/rbd/pnpm-volume/b276dc1f-5164-4cb6-81fb-861fd6d5ebb0/node_modules/fastify/lib/handleRequest.js:6:22)
5:59 PM
at Module._compile (internal/modules/cjs/loader.js:1085:14)
5:59 PM
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
According to one forum, this TypeError: diagnostics.tracingChannel is not a function error is resolved by using node version 18.19.0 or possibly version 20 or higher.
So I tried changing node to 18.19.0 in package.json but I get a compile message saying it is not found and the version is reverted to 10.0. I also tried changing to version 20.x but had the similar result.
How can I resolve this?