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.

CLI: `cdk init` fails if run under a directory where `cdk.json` exists

See original GitHub issue

I have a messy ~/Temp directory where I try out all kinds of things.

It so happens that ~/Temp/cdk.json exists, but what happens since is that I can’t run cdk init anymore anywhere under ~/Temp, which I do all the time:

huijbers ~/Temp> cd cdk-java-app/
huijbers ~/T/cdk-java-app> cdk init --language=java
'cdk init' cannot be run in a non-empty directory!

Well the directory is empty! I just made it!

Turns out that the CLI chdir()s to ~/Temp before cdk init is run, but it’s super hard for me to figure that out.

Can I suggest that the magic chdir behavior only happens when applicable to an existing CDK app, for commands like synth and deploy etc?

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

rix0rrrcommented, Jan 16, 2020

I would argue this is not really a p0 though.

iliapolocommented, Jan 21, 2020

I am closing this issue since the feature that caused this bug was reverted in version 1.21.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common AWS CDK issues
The file cdk.json in this directory, created by the cdk init command, contains the command line needed to run (and thereby synthesize) your...
Read more >
AWS CDK Init for an existing project - Stack Overflow
❯ cdk init app --language=csharp `cdk init` cannot be run in a non-empty directory! The CDK Workshop uses the example of starting from...
Read more >
How to install AWS CDK (step-by-step guide)
To install AWS CDK, run the following command in your terminal: npm install -g aws-cdk . This will install the AWS CDK package...
Read more >
@seed-run/aws-cdk - npm
When your stack finishes deploying, all stack outputs will be written to the output file as JSON. Usage of output in a CDK...
Read more >
Initializing a new CDK app - Taimos GmbH
To make sure you use the correct version of the CDK CLI in your following command you can use the provided NPM script...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found