Node 'jws' (JSON web signatures) package won't load

The error I receive says:

Error: Cannot find module ‘jwa’

The only thing is—I’m requiring jws, not jwa. And I haven’t made a spelling error. My code is very straightforward:

const jws = require('jws');

const signature = jws.sign({
  header: { alg: 'HS256' },
  payload: 'loremipsum',
  secret: process.env.SECRET
});

return signature;

Perhaps though, there is a spelling error in runkit’s backend which is causing this error and making this package impossible to locate, given the proximity of the ‘a’ key to the ‘s’ key on a keyboard.

Thanks,
Avana

1 Like

jwa is a dependency of jws, though at a glance I can’t see why it wouldn’t be able to be found.

1 Like

Hi Avana,

As was mentioned in the prior comment, jwa is a dependency. As for why it wasn’t available, it’s hard to say. It says there was an error, but the error itself was dropped from our records. The package was published some 3 years ago, could have been a bug on our end or something like npm just timing out at the time.

Regardless, I’ve reprocessed the package and it’s now available, which should fix jwt for you.

Sorry about that!
- Randy

1 Like

Sorry I didn’t respond to this more quickly—thank you.

1 Like