cdk-ecr-deployment icon indicating copy to clipboard operation
cdk-ecr-deployment copied to clipboard

Types of property 'node' are incompatible

Open Butterneck opened this issue 2 years ago • 0 comments

when using this code:

new ecrdeploy.ECRDeployment(this, 'DeployDockerImage', {
            src: new ecrdeploy.DockerImageName(asset.imageUri),
            dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/test:nginx`),
          });

I am receiving the error that this from does not match the typing:

Type 'AppStack' is not assignable to type 'Construct'.
    Types of property 'node' are incompatible.
      Type 'import("XXX/node_modules/constructs/lib/construct").Node' is not assignable to type 'import("XXX/node_modules/cdk-ecr-deployment/node_modules/constructs/lib/construct").Node'.
        Types have separate declarations of a private property 'host'.

My package.json dependencies are the following

"devDependencies": {
    "@aws-sdk/client-acm": "^3.226.0",
    "@types/aws-lambda": "^8.10.109",
    "@types/jest": "^27.0.0",
    "@types/node": "^14",
    "@typescript-eslint/eslint-plugin": "^5",
    "@typescript-eslint/parser": "^5",
    "aws-cdk-lib": "2.51.0",
    "aws-lambda": "^1.0.7",
    "cdk-ecr-deployment": "2.5.6",
    "constructs": "10.0.5",
    "esbuild": "^0.16.4",
    "eslint": "^8",
    "eslint-import-resolver-node": "^0.3.6",
    "eslint-import-resolver-typescript": "^3.1.3",
    "eslint-plugin-import": "^2.26.0",
    "fast-check": "^3.2.0",
    "jest": "^27.0.0",
    "jest-junit": "^13",
    "jsii": "^1.61.0",
    "jsii-diff": "^1.61.0",
    "jsii-docgen": "^7.0.43",
    "jsii-pacmak": "^1.61.0",
    "json-schema": "^0.4.0",
    "npm-check-updates": "^16",
    "projen": "^0.65.58",
    "standard-version": "^9",
    "ts-jest": "^27.0.0",
    "typescript": "^4.7.4"
  },
  "peerDependencies": {
    "aws-cdk-lib": "^2.51.0",
    "cdk-ecr-deployment": "^2.5.6",
    "constructs": "^10.0.5"
  },

The strange thing is that the content of XXX/node_modules/cdk-ecr-deployment/node_modules/constructs/lib/construct/version.json is

{
  "version": "10.0.0"
}

even if XXX/node_modules/cdk-ecr-deployment/package.json contains

"peerDependencies": {
    "aws-cdk-lib": "^2.0.0",
    "constructs": "^10.0.5"
  },
  "dependencies": {
    "aws-cdk-lib": "^2.0.0",
    "constructs": "^10.0.5",
    "got": "^11.8.3",
    "hpagent": "^0.1.2"
  },

I can't find a valid reason why [email protected] is installed instead of constructs@^10.0.5

Butterneck avatar Dec 15 '22 10:12 Butterneck