'Uninstall AWS CDK Command Line Tool on Ubuntu 20.04.3LTS
UPDATE: Resolved by removing the .nvm folder, closing terminal, and then running npm install -g [email protected] again resolved the issue. I hope this helps anyone else experiencing the same problem.
I am trying to upgrade from AWS CDK 1 to 2, but for some reason I am unable to update the CDK command line tool on my machine. No matter what version I install through npm, running cdk --version still prints 1.89.0 for me.
So I figured I would just uninstall the CDK and start over. Sadly, that didn't work either.
I've tried both updating and uninstalling globally:
13:52 $ npm install -g [email protected]
added 212 packages, and audited 213 packages in 20s
1 critical severity vulnerability
To address all issues, run:
npm audit fix
Run `npm audit` for details.
13:54 $ cdk --version
1.89.0 (build df7253c)
13:54 $ npm uninstall -g aws-cdk
up to date, audited 1 package in 781ms
found 0 vulnerabilities
And locally:
14:10 $ npm uninstall aws-cdk
up to date, audited 1 package in 859ms
found 0 vulnerabilities
I'm using the following versions:
- Ubuntu 20.04.3 LTE
- Node 16.3.0 through nvm 0.39.1
- npm 8.5.0
I also checked if "cdk" actually refers to a apt-get or snap package, but I didn't see anything when listing all packages with either snap list or apt list --installed.
Any help greatly appriciated!
Solution 1:[1]
The issue probably is, that you have an old npm global folder lying around, that has an old duplicate cdk version in there.
I had the same issue after moving nodejs from apt-get to nvm. nvm set up a new path to store global npm packages resulting in two different versions of cdk being installed. I removed the old npm global path. Uninstalling .nvm folder in general is a bad solution.
- Run
npm i -g aws-cdk - Run
where cdkto see the installation paths foraws-cdk. - If you see more than 1 entry you have duplicate installations
- Figure out, which path is the correct one and remove the other paths
Solution 2:[2]
[100%] fail: No bucket named ‘cdktoolkit-stagingbucket-########’. Is account ######### bootstrapped? Cause: CDK requires a staging bucket in S3 containing CDK assets, which may have been removed.
Investigation:
Running aws s3 ls does not yield the bucket. Fix:
Navigate to the AWS management console
Open CloudFormation
Look for and remove the stack called CDKToolkit
? Now re-run cdk bootstrap this will re-generate the staging bucket and the stack CDKToolkit
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | wasserholz |
| Solution 2 | naman kumar |
