0

When attempting to initialise a new cdk project in a windows WSL environment, I was confronted with the following error:

cdk init test-app --language python
Usage:
  cdk [-vbo] [--toc] [--notransition] [--logo=<logo>] [--theme=<theme>] [--custom-css=<cssfile>] FILE
  cdk --install-theme=<theme>
  cdk --default-theme=<theme>
  cdk --generate=<name>

I first wanted to check the install was still correct but the version number is not displayed:

cdk --version
cdk

All advice online and on Stack Overflow suggests re-installing as root user. I have attempted a global install as root, followed by a restart:

sudo npm install -g aws-cdk

checking for global install version lists the following, showing the update has had global effect:

npm list -g --depth=0 | grep cdk
├── aws-cdk@2.15.0
├── cdk-assume-role-credential-plugin@1.4.0

but the error remains the same. Running the which command confirms it is following the correct user path:

which cdk
/home/user/.local/bin/cdk

This is a new error and I am unable to pinpoint any particular change that could have caused this. I have been able to initialise cdk projects in empty directories before without issue.

2
  • 1
    You have another file called cdk which is present in /home/user/.local/bin/cdk which seems to be hijacking. I'd recommend removing that file if you're sure that's not required Mar 5, 2022 at 13:57
  • That got it. Very confusing as now there is no cdk file within the local bin folder. I am unsure how this double-install happened or which path it is currently using without it.
    – RAH
    Mar 5, 2022 at 14:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.