nanoid: Error: No valid exports main found for '/path/to/nanoid'

As initially described at , I am getting a MODULE_NOT_FOUND error with node@13.2.0 and yarn@1.22.4.

Here is the repro:

And a sample run on my local:

cansin@localhost nanoid-repro % node --version
cansin@localhost nanoid-repro % yarn --version
cansin@localhost nanoid-repro % yarn install
yarn install v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...

✨  Done in 0.09s.
cansin@localhost nanoid-repro % node index.js 
  throw e;

Error: No valid exports main found for '/Users/cansin/code/nanoid-reprod/node_modules/nanoid'
    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/cansin/code/nanoid-reprod/index.js:1:20)
    at Module._compile (internal/modules/cjs/loader.js:1121:30) {


About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (17 by maintainers)

Most upvoted comments

@marcelo-michels The latest node 13 should work fine. The problem happens only with early versions.

The warning is OK

Thanks for the repo. I will take a look today or tomorrow.