Angular Nx Nrwl - 无法解析 tsconfig.base.json: PropertyNameExpected in JSON 尝试创建新库时
Angular Nx Nrwl - Cannot parse tsconfig.base.json: PropertyNameExpected in JSON when try to create a new lib
我遇到了这个错误
Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891
当我在 CLI 上 运行 nx g @nrwl\angular:lib libName
我的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"]
}
当我 运行 我收到错误 Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891
。
当我尝试 运行 npx nx g @nrwl/angular:lib libName
或 nx g @nrwl/angular:lib
时也会发生同样的情况
我正在使用 VScode 编写代码,tsconfig.base.json
中没有错误警告(lint)
当 paths
列表末尾有一个逗号 ',' 时出现此错误。
"@portal/*": ["apps/portal/src/app/*"], <<< REMOVE this comma
是的,这正是解决方案 - 删除逗号:
"路径": { "@sokar/products":["libs/products/src/index.ts"],<<-- }
enter image description here
我遇到了这个错误
Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891
当我在 CLI 上 运行 nx g @nrwl\angular:lib libName
我的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"]
}
当我 运行 我收到错误 Cannot parse tsconfig.base.json: PropertyNameExpected in JSON at position 891
。
当我尝试 运行 npx nx g @nrwl/angular:lib libName
或 nx g @nrwl/angular:lib
我正在使用 VScode 编写代码,tsconfig.base.json
当 paths
列表末尾有一个逗号 ',' 时出现此错误。
"@portal/*": ["apps/portal/src/app/*"], <<< REMOVE this comma
是的,这正是解决方案 - 删除逗号: "路径": { "@sokar/products":["libs/products/src/index.ts"],<<-- } enter image description here