简体   繁体   English

在 MacO 上找不到 cdk 命令

[英]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 .我试图在我的 Mac 上安装aws-cdk ,它是通过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 .但是当我尝试使用cdk --version验证安装时,我收到错误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 .根据 AWS 文档, aws-cdk与 Node.js 版本 13.0.0 到 13.6.0 不兼容,但我得到了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.这听起来像是你机器上的 node/npm 版本在某种程度上处于错误的 state 中。 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我建议您按照这个答案在您的 Mac 上完全重新安装 nodejs 并重新安装 cdk(如果您还没有的话)

I solve it but didn't found the reason.我解决了,但没有找到原因。 It was solved by adding an alias to.bash_profile as通过将别名添加到.bash_profile 解决了这个问题

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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