You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { verify } from "jsonwebtoken"; ^^^^^^SyntaxError: Named export 'verify' not found. The requested module 'jsonwebtoken' is a CommonJS module, which may not support all module.exports as named exports.CommonJS modules can always be imported via the default export, for example using:import pkg from 'jsonwebtoken';const { verify } = pkg; at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21) at async ModuleJob.run (node:internal/modules/esm/module_job:217:5) at async ModuleLoader.import (node:internal/modules/esm/loader:323:24) at async loadESM (node:internal/process/esm_loader:28:7) at async handleMainPromise (node:internal/modules/run_main:120:12)Node.js v21.7.0
It works on v9.0.0 but fails on 9.0.2.
Environment
Please provide the following:
Version of this library used: 9.0.2
Version of the platform or framework used, if applicable:
Other relevant versions (language, server software, OS, browser):
Other modules/plugins/libraries that might be involved:
The text was updated successfully, but these errors were encountered:
I started experiencing this problem after I switched to using ESM modules on my code. The solution, as the error message suggests, was to stop using named exports and rely on the default import syntax.
I just commented @ts-ignore before calling verify method and it all started working. Weird. Can anyone tell me what might be the issue? Using Nitro server.
Description
import
jsonwebtoken
throws errorReproduction
The code:
The error message:
It works on v9.0.0 but fails on 9.0.2.
Environment
The text was updated successfully, but these errors were encountered: