Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package exports do not define a valid '.' target #85

Closed
maxijabase opened this issue Aug 7, 2020 · 6 comments
Closed

Package exports do not define a valid '.' target #85

maxijabase opened this issue Aug 7, 2020 · 6 comments

Comments

@maxijabase
Copy link

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'
}```
@canpoyrazoglu
Copy link

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

@Caligatio
Copy link
Owner

@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.

@canpoyrazoglu
Copy link

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

@Caligatio
Copy link
Owner

@canpoyrazoglu I'll cut v3.1.2 tomorrow morning

@Caligatio
Copy link
Owner

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

@Caligatio
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants