How to fix the Error Argument of type ‘this’ is not assignable to parameter of type ‘Construct’. when you build the AWS CDK stack
What I saw Create a new Stack by AWS CDK Nothing to do several days. Add new resources into the project Failed […]
広告ここから
広告ここまで
目次
What I saw
- Create a new Stack by AWS CDK
- Nothing to do several days.
- Add new resources into the project
- Failed the
npm run build
command with theArgument of type 'this' is not assignable to parameter of type 'Construct'
error.
Why I get the Error
The error comes from version diff. My package.json is following. The SNS / SQS and core packages are v0.13.0, but EC2 is v0.14.1.
"devDependencies": {
"@types/node": "^8.9.4",
"typescript": "^3.1.2",
"aws-cdk": "^0.13.0"
},
"dependencies": {
"@aws-cdk/aws-ec2": "^0.14.1",
"@aws-cdk/aws-sns": "^0.13.0",
"@aws-cdk/aws-sqs": "^0.13.0",
"@aws-cdk/cdk": "^0.13.0"
}
I resolved the issue by rm -rf node_modules/ && npm i
command.
"devDependencies": {
"@types/node": "^8.9.4",
"typescript": "^3.1.2",
"aws-cdk": "^0.14.1"
},
"dependencies": {
"@aws-cdk/aws-ec2": "^0.14.1",
"@aws-cdk/aws-sns": "^0.14.1",
"@aws-cdk/aws-sqs": "^0.14.1",
"@aws-cdk/cdk": "^0.14.1"
}