简体   繁体   中英

Angular Nx Nrwl - Cannot parse tsconfig.base.json: PropertyNameExpected in JSON when try to create a new lib

Im getting this error

Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891

when i run nx g @nrwl\angular:lib libName on CLI

my tsconfig.base.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@admin-env/*": ["apps/admin/src/environments/*"],
      "@admin/*": ["apps/admin/src/app/*"],
      "@portal-env/*": ["apps/portal/src/environments/*"],
      "@portal/*": ["apps/portal/src/app/*"],
    }
  },
  "exclude": ["node_modules", "tmp"]
}

When i run i'm getting the error Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891 .

The same happens when i try to run npx nx g @nrwl/angular:lib libName or nx g @nrwl/angular:lib

I'm usin VScode to write code, and there is no warning (lint) of error in tsconfig.base.json

paths列表末尾有逗号“,”时,我收到此错误。

"@portal/*": ["apps/portal/src/app/*"],  <<< REMOVE this comma

是的,这正是解决方案 - 删除逗号: "paths": { "@sokar/products":["libs/products/src/index.ts"],<<-- }在此处输入图像描述

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