In shell scripts interacting with the AWS CDK Toolkit, I often see both npx -- cdk
and npx -- aws-cdk
. Apparently, there are two npm packages cdk
and aws-cdk
. What is the difference between these two?
Moreover, I make confusing observations when interacting with these two packages.
npx -- cdk --version # output: Need to install the following packages: cdk@2.32.1
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk@2.32.1
Since neither package is installed locally, both commands want to install the corresponding package, fine.
npm install -g cdk@2.32.0
npx -- cdk --version # output: 2.32.0 (build 00e0c2d)
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk@2.32.1
After installing cdk
locally, npx -- cdk
executes the local package and npx -- aws-cdk
still wants to install aws-cdk
, also fine.
npm install -g aws-cdk@2.32.0
npx -- cdk --version # output: 2.32.0 (build 00e0c2d)
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk@2.32.1
Now it gets confusing. Although we locally installed aws-cdk
rather than cdk
, npx -- cdk
still executes some local package and npx -- aws-cdk
still wants to install aws-cdk
. Why?