Angular Nx Nrwl - 尝试创建新库时无法解析 tsconfig.base.json:JSON 中的 PropertyNameExpected

Lui*_*ndo 22 json angularjs angular nrwl nrwl-nx

我收到这个错误

Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891
Run Code Online (Sandbox Code Playgroud)

nx g @nrwl\angular:lib libName当我在 CLI 上运行时

我的 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"]
}
Run Code Online (Sandbox Code Playgroud)

当我运行时,我收到错误Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891

当我尝试跑步npx nx g @nrwl/angular:lib libNamenx g @nrwl/angular:lib

我正在使用 VScode 编写代码,并且没有错误警告(lint)tsconfig.base.json

Lui*_*ndo 78

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

"@portal/*": ["apps/portal/src/app/*"],  <<< REMOVE this comma
Run Code Online (Sandbox Code Playgroud)

  • 是的 - 花了几个小时寻找解决方案,就是这个简单的修复。谢谢 (2认同)