简体   繁体   中英

AWS CDK: AWS-ec2 SyntaxError: Unexpected token '.' after update node

I update NX and related versions. so now using node 14.15.0 instead of node 12.20.2

node version updated. so I update the aws-cdk packages. but now the following command is not working anymore. the issue is the optional chaining operator in aws-ec2 .

npx env-cmd -f pipeline.json npx ts-node --project./scripts/tsconfig.json./apps/cloud-infrastructure/src/bin/pre-build.ts

I get the following error when I fire the above command.

在此处输入图像描述

node version 14.15.0 . (tried in another version as well)

在此处输入图像描述

compiler options in ts config tsconfig.base.json

  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom",
      "esnext.asynciterable"
    ],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true
}
"files": [
    "./polyfills.localize.ts"
  ],
  "exclude": [
    "node_modules",
    "tmp"
  ]

ts config

{
  "extends": "../tsconfig.base.json",
  "compilerOptions": {
    "types": ["node", "jest"],
    "lib": ["ES6", "ES2017", "es2015", "ES2020.Promise"],
    "module": "CommonJS"
  },
  "include": ["**/*.ts"]
}

As mentioned on this answer to a GitHub issue, you probably need to update Node from 12 (either to 14 or 16). The best way to do this is to update your package file, run npm update , then resolve dependency issues.

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