question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package exports do not define a valid '.' target

See original GitHub issue

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'
}```

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Caligatiocommented, Aug 7, 2020

@canpoyrazoglu I’ll cut v3.1.2 tomorrow morning

1reaction
canpoyrazoglucommented, Aug 7, 2020

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Package exports for tslib do not define a valid '.' target
I had a similar issue and I workarounded by downgrading node version (from v13.0.1 to v12.19.0). It's probably not the ideal solution, ...
Read more >
node v13.0-v13.1 errors on require of a module with " ...
I get this error: Error: Package exports for 'path/to/package' do not define a valid '.' target when, in the node v13.1 repl (where...
Read more >
Package exports
Target environment independent packages. These patterns make sense for packages that do not use environment specific APIs. Providing only an ESM version.
Read more >
Ionic cli error: package exports invalid
Error : Package exports for '/usr/local/lib/node_modules/@ionic/cli/node_modules/uuid' do not define a valid '.' target.
Read more >
Error: Package exports for '/app/node_modules/uuid' do not ...
Coding example for the question Error: Package exports for '/app/node_modules/uuid' do not define a valid '.' target-node.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found