Search code examples
jsonangularangularjsnrwl-nxnrwl

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


Solution

  • I got this error when there was a comma ',' at the end of the paths list.

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