Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App deploys with cdk v2 but unable to run cdklocal. Error: Cannot find module 'aws-cdk/lib/api/aws-auth' #70

Closed
anafaggiano opened this issue May 25, 2022 · 1 comment

Comments

@anafaggiano
Copy link

anafaggiano commented May 25, 2022

I'm upgrading my app to the newer version (2.x.x) of the CDK but cdk-local can't seem to deploy properly. My app, however, deploys properly in aws.
My latest package json looks like:

 "scripts": {
    "cdklocal": "cdklocal",
    "cdklocal:deploy": "cdklocal deploy"
  },
  "devDependencies": {
    "aws-cdk-lib": "2.25.0",
    "aws-cdk-local": "2.15.0",
    "constructs": "10.1.17"
  },

When running npm run cdklocal:deploy -- ${params} or even just npm run cdklocal -- --version, I'm getting:

Error: Cannot find module 'aws-cdk/lib/api/aws-auth'
Require stack:
- /Users/anais/dev/graphql/node_modules/aws-cdk-local/bin/cdklocal
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at patchPre_2_14 (/Users/anais/dev/graphql/node_modules/aws-cdk-local/bin/cdklocal:311:20)
    at Object.<anonymous> (/Users/anais/dev/graphql/node_modules/aws-cdk-local/bin/cdklocal:331:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/anais/dev/graphql/node_modules/aws-cdk-local/bin/cdklocal'
  ]
}

I've removed node_modules countless times, uninstall/reinstalled with different versions (for instance, aws-cdk-lib 2.15.0 and aws-cdk-local 2.15.0 per this closed issue) but I can't seem to find 2 versions that fit together.

I'm seeing aws-cdk and not aws-cdk-lib everywhere in the doc. Does this mean that this can't run with the offical aws-cdk-lib ? If not, what version combination should work?

Thanks in advance,

@andrewdhazlett
Copy link

If I understand correctly you still need "aws-cdk": "2.x.x". aws-cdk-lib is just for the constructs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants