1

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?

andrey.shedko
  • 3,128
  • 10
  • 61
  • 121

3 Answers3

1

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"
andrey.shedko
  • 3,128
  • 10
  • 61
  • 121
0

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

alex9311
  • 1,230
  • 1
  • 18
  • 42
0

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"