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.

No valid exports main found for @urql/core - ts-node in a Next.js project

See original GitHub issue

Hello,

As promised, here is a minimal reproduction of an issue I am running into when trying to use the latest version of urql in a Next.js project ran by ts-node.

Note: All works as expected if I use next-urql: 0.3.3 and urql: 1.9.1.

Let me know if I can help with figuring this out.

urql version & exchanges: urql: 1.9.7 next-urql: 0.3.7

Default exchanges used

Steps to reproduce

  1. Clone this repository: https://github.com/OriginalEXE/urql-import-problem-reproduction
  2. Run npm install
  3. Run npm run start and wait for the server to start
  4. Visit http://localhost:3000

Expected behavior The website should show “Hello world”

Actual behavior An error is thrown:

Error: No valid exports main found for '/Users/ante/Projects/urql-import-problem-reproduction/node_modules/@urql/core'
    at resolveExportsTarget (internal/modules/cjs/loader.js:611:9)
    at applyExports (internal/modules/cjs/loader.js:492:14)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:643:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:941:27)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at Object.<anonymous> (/Users/ante/Projects/urql-import-problem-reproduction/node_modules/urql/dist/urql.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
    at Object.require.extensions.<computed> [as .js] (/Users/ante/Projects/urql-import-problem-reproduction/node_modules/ts-node/src/index.ts:832:44)
    at Module.load (internal/modules/cjs/loader.js:976:32)
    at Function.Module._load (internal/modules/cjs/loader.js:884:14)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18) {
  code: 'MODULE_NOT_FOUND'
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
OriginalEXEcommented, Apr 23, 2020

Woohoo, once I switched to Node 14.0.0, it all works. Thanks so much for making me try this 🎉

I was on 13.2.0 and I can still reproduce this once I switch back to that version, so maybe something specific to that version triggers this issue.

In any case, thanks again for all of your work here, and hopefully, if anyone else out there runs into this issue, this thread helps them as well 😄

1reaction
kindaycommented, Apr 27, 2020

We switched back to 12.16.2 and it works. Didn’t work on 13.6.0 though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No valid exports main found for node_modules\uuid #5381
Hi, I just updated my project using npm -update @loopback/cli and lb4 update. No errors on build but when I start I get...
Read more >
How do I fix my "No valid exports main found" compile error?
In my chrome and terminal, it says like this way. Failed to compile ./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6- ...
Read more >
How to fix “Error: No valid exports main found for ... - Dev Genius
Recently when I was developing for a React application that I hadn't pulled from the master branch in a while, I came across...
Read more >
How to fix “Error: No valid exports main found ... - Godwill Barasa
On 12th May, as I was trying to “npm run dev” a react application that I ... Error: No valid exports main found...
Read more >
HOW TO SOLVE THE NO VALID EXPORTS ERROR IN ...
Recently while running the sequelize-cli init command, I ran into an error. The error message was something like export not found.
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