Caligatio/jsSHA

Package exports do not define a valid '.' target

maxijabase opened this issue · 6 comments

I'm having issues with importing jssha

G:\Mierda\testnpm>npx nodemon
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
internal/modules/cjs/loader.js:463
  throw e;
  ^

Error: Package exports for 'G:\Mierda\testnpm\node_modules\jssha' do not define a valid '.' target
    at resolveExportsTarget (internal/modules/cjs/loader.js:460:13)
    at resolveExports (internal/modules/cjs/loader.js:393:16)
    at Function.Module._findPath (internal/modules/cjs/loader.js:492:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:787:27)
    at Function.Module._load (internal/modules/cjs/loader.js:693:27)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (G:\Mierda\testnpm\index.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:971:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10) {
  code: 'MODULE_NOT_FOUND'
}
[nodemon] app crashed - waiting for file changes before starting...

index.js has:

const jssha = require('jssha');

Extra info:

G:\Mierda\testnpm>npm version
{
  testnpm: '1.0.0',
  npm: '6.12.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '79',
  napi: '5',
  nghttp2: '1.39.2',
  node: '13.0.1',
  openssl: '1.1.1d',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.33.1',
  v8: '7.8.279.17-node.14',
  zlib: '1.2.11'
}```

Not sure if it's related but on React Native I'm also getting an error like:

Package jssha has been ignored because it contains invalid configuration.
Reason: Package subpath './package.json' is not defined by "exports" in /path_to_my_project/node_modules/jssha/package.json

@canpoyrazoglu This appears to be a problem with React but I can add a silly patch to fix it. Can you try b6a3792?

@ratawar I literally have no idea what issue you're hitting as I can import it fine. What version of node are you using? It appears that v13 may have had some issues with the new export syntax.

@Caligatio yup, I confirm that b6a3792 solves the warning. Thanks for the quick response!

@canpoyrazoglu I'll cut v3.1.2 tomorrow morning

I'm not sure if these problems were actually related but @ratawar, did v3.1.2 fix your issue as well?

I'm closing this due to inactivity and because it might be fixed already. If this is still an issue, please feel free to reopen.