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.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]

See original GitHub issue

I keep on getting this error since I installed this module yesterday

 Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/dev/projects/api/node_modules/jose/package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
at packageExportsResolve (internal/modules/esm/resolve.js:513:3)
at resolveExports (internal/modules/cjs/loader.js:432:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:61:29)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/dev/projects/api/src/utils/utils.ts:5:14)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Environment:

  • jose version: [e.g. v3.5.1]
  • affected runtime is: [e.g. Node.js 14.15.4 npm version 6.14.11

My tscongig:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "target": "es6",
    "noImplicitAny": false,
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "dist",
    "baseUrl": ".",
    "paths": {
      "*": [
        "node_modules/*",
        "src/types/*"
      ]
    },
    "lib": [
      "es2015"
    ]
  },
  "include": [
    "src/**/*"
  ]
}

Possibly related dependencies I use:

{"typescript": "^4.1.3",
    "webpack": "^5.12.3",
    "webpack-cli": "^4.3.1",
    "webpack-dev-server": "^3.11.1"
  },

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
panvacommented, Mar 26, 2021

I will repeat again,

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in .../node_modules/jose/package.json means you’re doing require/import of just jose. Please refer to each individual module’s documentation on how to require/import the respective functions.

Instead of, e.g. const { SignJWT } = require('jose/jwt/sign') you’re probably doing something like const jose = require('jose').

Follow the documentation, please 🙏 .

Screenshot 2021-03-26 at 16 01 52
0reactions
panvacommented, Oct 18, 2021

See v4.x and the updated module’s docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No "exports" main resolved in /app/node_modules/@babel ...
node 13.14.0, node 12.18.4, 12.19.0, 12.19.1 show the error : ERR_PACKAGE_PATH_NOT_EXPORTED; With node 12.20.0, node 14.17.4, the error is ...
Read more >
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'
Run the npm update command to solve the "Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'" and then run npm audit fix --force if necessary.
Read more >
No "exports" main defined - Laracasts
Hello , After cloning my project I got the error bellow when I npm run watch (I deleted ... Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports"...
Read more >
error [err_package_path_not_exported]: package subpath
Run the npm update command to solve the "Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'" and then run npm audit fix --force if necessary. The npm...
Read more >
ERR_PACKAGE_PATH_NOT_E...
Npm #NpmErrorERR_PACKAGE_PATH_NOT_EXPORTED NPM Error FixThe error Error [ ERR_PACKAGE_PATH_NOT_EXPORTED ]: No "exports" main resolved in...
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