CLI: `cdk init` fails if run under a directory where `cdk.json` exists
See original GitHub issueI 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 https://github.com/aws/aws-cdk/pull/5772 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:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would argue this is not really a p0 though.
I am closing this issue since the feature that caused this bug was reverted in version
1.21.1
.