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 - No "exports" main defined

See original GitHub issue

Hi

I’m using: Node.js v18.0.0 Graphql-upload 16.0.2 Express 4.18.1 Only JavaScript

const { graphqlUploadExpress } = require("graphql-upload"); 

And show this Error:

node:internal/modules/cjs/loader:489
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /node_modules/graphql-upload/package.json

Command audit:

npm audit
found 0 vulnerabilities

I already executed these commands, but they do not solve anything:

# 👇️ delete node_modules and package-lock.json
rm -rf node_modules
rm -f package-lock.json
rm -f yarn.lock

# 👇️ clean npm cache
npm cache clean --force

npm install

how do I fix this error?

Thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
stanyq4commented, Nov 25, 2022

Same here, been trying to upgrade to the LTS node “18.12.1” using Typescript, but this became a blocker.

@jaydenseric anything you can recommend for TS?

2reactions
yangli-iocommented, Nov 24, 2022

I’m using typescript and this mjs stuff has just made it super hard to use. I have to do stuff like allowJS which I strictly avoided before to ensure typescript was being used. Still I’m not able to get this to work

Read more comments on GitHub >

github_iconTop Results From Across the Web

No "exports" main resolved in /app/node_modules/@babel ...
With node 12.20.0, node 14.17.4, the error is not thrown. The issue is that a new system for exports has been created, as...
Read more >
No "exports" main defined in package.json · Issue #4138 · ipfs ...
ipfs@0.63.x is ESM-only, which means you can't use require to load it, you have to use import . Please see the upgrade guide....
Read more >
No "exports" main defined - Laracasts
Hello , After cloning my project I got the error bellow when I npm run watch (I deleted the node_modules) ERROR in ./resources/js/app.js...
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 >
Modules: Packages | Node.js v19.3.0 Documentation
The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, ...
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