andrey.shedko
andrey.shedko

Reputation: 3238

cdk command not found on MacOs

I was trying to install aws-cdk on my Mac, it was installed successfully via npm install -g aws-cdk version 1.85.0. But then when I was trying to verify the installation with cdk --version I got the error bash: cdk: command not found. According to AWS documentation, aws-cdk is not compatible with Node.js version 13.0.0 to 13.6.0, but I got v14.15.4. How this can be fixed?

Upvotes: 1

Views: 4207

Answers (3)

I had this problem on my mac air m1 2020. Open the .zprofile file in vscode and paste:

# Setting path to aws cdk
alias cdk="./.npm-global/bin/cdk"

Upvotes: 0

andrey.shedko
andrey.shedko

Reputation: 3238

I solve it but didn't found the reason. It was solved by adding an alias to .bash_profile as

# Setting path to aws cdk
alias cdk="/Users/andreyshedko/.npm-global/bin/bin/cdk"

Upvotes: 1

alex9311
alex9311

Reputation: 1410

this sounds like the node/npm version(s?) on your machine are in a bad state somehow. I'd recommend following this answer on doing a full re-install for nodejs on your mac and reinstalling cdk if you haven't yet

Upvotes: 0

Related Questions