auth0 / node-jsonwebtoken

JsonWebToken implementation for node.js http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html
MIT License
17.58k stars 1.22k forks source link

import not working on node 18.12 #907

Open ofu997 opened 1 year ago

ofu997 commented 1 year ago

I'm importing using var jwt = require('jsonwebtoken') and my page will not load, showing the below image

image

version: ^9.0.0 React JS: ^17.0.2 Node: 18.12.1

relayranger commented 1 year ago

I'm importing using var jwt = require('jsonwebtoken') and my page will not load, showing the below image

image

version: ^9.0.0 React JS: ^17.0.2 Node: 18.12.1

I have the same issue

skarjalainen commented 1 year ago

This works for me

import * as jwt from 'jsonwebtoken';

Or

import { sign, verify } from 'jsonwebtoken';

BastianAhumada commented 1 year ago

@skarjalainen what is your nodejs version ?

Arecsu commented 1 year ago

This works for me

import * as jwt from 'jsonwebtoken';

Or

import { sign, verify } from 'jsonwebtoken';

None of this works for me. This one worked for me:

import jwt from 'jsonwebtoken'

Tested in 8.5.1 and latest 9.0.0

ghost commented 1 year ago

I'm importing using var jwt = require('jsonwebtoken') and my page will not load, showing the below image

image

version: ^9.0.0 React JS: ^17.0.2 Node: 18.12.1

I'm not sure if jsonwebtoken supports commonjs modules. I would just try import jwt from 'jsonwebtoken' instead.

AnasRezaMdlz commented 9 months ago

For me none working in my React project. Can someone pls help

import jwt from 'jsonwebtoken' import * as jwt from 'jsonwebtoken'; import { sign, verify } from 'jsonwebtoken';