这个错误通常发生在使用 Angular NX 工作区时忘记在 package.json 文件中指定主应用程序的入口点。要解决这个错误,可以按照以下步骤操作:
"my-app": {
"projectType": "application",
"root": "apps/my-app",
"sourceRoot": "apps/my-app/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/apps/my-app",
"index": "apps/my-app/src/index.html",
"main": "apps/my-app/src/main.ts", // 这里指定了主应用程序的入口点
"polyfills": "apps/my-app/src/polyfills.ts",
// ...
},
// ...
},
// ...
}
},
总之,确保在 package.json 中指定主应用程序的入口点是解决这个错误的关键。