简体   繁体   中英

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?

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM