Aws-cdk: ‼️ NOTICE: cannot install `aws-cdk` with Node v13.0.0 - v13.6.0 - Error: No valid exports main found - UUID import fails in 1.37.0

Created on 6 May 2020  ·  6Comments  ·  Source: aws/aws-cdk

Hello.

After upgrading to 1.37.0, I ran into an error:

Error: No valid exports main found for '~/.nvm/versions/node/v13.2.0/lib/node_modules/aws-cdk/node_modules/uuid'
    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> (~/.nvm/versions/node/v13.2.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)

Reproduction Steps

➜  ~ npm install aws-cdk -g       
+ [email protected]
updated 10 packages in 2.559s
➜  ~ cdk init --language javascript
Error: No valid exports main found for '~/.nvm/versions/node/v13.2.0/lib/node_modules/aws-cdk/node_modules/uuid'
    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> (~/.nvm/versions/node/v13.2.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)

Environment

  • CLI Version : 1.37.0
  • Framework Version: 1.37.0
  • OS :MacOS 10.15.4
  • Language : JS

Other

From looking around, I think this is tied to the upgrade of uuid to v 8.0.0
but v8.0 of uuid has a breaking change where the generic uuid module is not exported anymore, yet, it is still used in CDK, at least here

Thank you.


This is :bug: Bug Report

bug in-progress p1 packagtools

Most helpful comment

aws-cdk uses uuid library. The library has an resolved GitHub issue. The solution is updating node version from v13.x.x to latest v13 which is v13.14.0. When i updated to that version my node, i resolved this issue:
Related link:
https://github.com/uuidjs/uuid/issues/428

All 6 comments

My node is v12.14.1 and npm is 6.13.4 than i do not have this issue. By the way, my teammate has node v13.5.0 and npm 6.13.4 and he has similar issue with you. I think it is related with node version. Can you downgrade it while resolving this issue?

When i upgrade my node version to v13.5.0 i got same error

aws-cdk uses uuid library. The library has an resolved GitHub issue. The solution is updating node version from v13.x.x to latest v13 which is v13.14.0. When i updated to that version my node, i resolved this issue:
Related link:
https://github.com/uuidjs/uuid/issues/428

Upgrading to Node 14.2.0 solved the problem for me

Thanks @spg !
Upgrading Node to v14.1.0 using brew did fix the problem for me too.

Affected versions 13.0.0 to 13.6.0

Node13 is in Maintenance LTS and will be hitting EOL on 2020-06-01

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mirazmamun picture mirazmamun  ·  3Comments

Kent1 picture Kent1  ·  3Comments

abelmokadem picture abelmokadem  ·  3Comments

cybergoof picture cybergoof  ·  3Comments

slipdexic picture slipdexic  ·  3Comments