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?
Asked
Active
Viewed 3,027 times
1

andrey.shedko
- 3,128
- 10
- 61
- 121
-
can you add the output of `npm list -g aws-cdk` and `which node`? – alex9311 Jan 19 '21 at 17:32
-
@alex9311, node is 14.5.4 and cdk is 1.85.0 – andrey.shedko Jan 20 '21 at 16:12
-
P.S. /usr/local/bin/node – andrey.shedko Jan 20 '21 at 16:27
3 Answers
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
-
Thanks for the suggestion, I was completely removed Node.js but this doesn't help. – andrey.shedko Jan 20 '21 at 16:18
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"