How to create json web token?

I am going to create a new token using jwt so I tried to use this package.

I installed the package and tried to use sign function, but it throws jwt.sign is not a function error.

I checked the jwt but it’s just empty object.

import jwt from 'jsonwebtoken';


Log is just {} empty object.

Please help me on this.

Make sure you run it server side only and see if that works.