digitalbazaar / did-method-key

A did-io driver for the DID "key" method
Other
25 stars 10 forks source link

I'm facing issue with cannot import and use it. #52

Open ThomasLuuu opened 1 year ago

ThomasLuuu commented 1 year ago

error: Error: While trying to resolve module @digitalbazaar/did-method-key from file C:\Users\***\Work\***\app\lib\did.ts, the package C:\Users\***\Work\***\\node_modules\@digitalbazaar\did-method-key\package.json was s uccessfully found. However, this package itself specifies a main module field that could not be resolved (C:\Users\***\\Work\***\\node_modules\@digitalbazaar\did-method-key\index. Indeed, none of these files exist:

dlongley commented 1 year ago

There's no main entry in the latest version of the package, it instead uses exports:

https://github.com/digitalbazaar/did-method-key/blob/main/package.json#L21

Are you using an older version? If so, please try upgrading to the latest to see if it resolves your problem.

ThomasLuuu commented 1 year ago

I'm using the latest version of the package. "@digitalbazaar/did-method-key": "^3.0.0",

dlongley commented 1 year ago

It looks like the error message that's coming from whatever you're using to try and load the package is incorrect. There's no main module field in the package.json file. I suspect that the version of whatever you're using to load the module doesn't understand exports. You may need to upgrade your tooling.

ThomasLuuu commented 1 year ago

I saw that other packages also have exports and they all work fine. I don't know where the problem comes from.