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

1

22

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

Freeforall answered 21/9, 2021 at 16:1 Comment(0)
F
80

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

"@portal/*": ["apps/portal/src/app/*"],  <<< REMOVE this comma
Freeforall answered 21/9, 2021 at 16:1 Comment(3)
Yes - spent hours looking for solution, it was this simple fix. ThanksChura
I was missing commas in the tsconfig.base.json,Enallage
heroes not always wear capes!!Wrecker

© 2022 - 2024 — McMap. All rights reserved.