内部错误中的错误:未知标识符300
> ./src/main.ts中的错误 找不到模块:错误:无法解析'。/ $ _ gendir / app / app.module.ngfactory' in' C:\ Users ... \ ng-webapp \ SRC' @ ./src/main.ts 3:0-74 @ multi webpack-dev-server / client?http://localhost:4200 ./src/main.ts谢谢你的帮助!
我从谷歌找到了一些答案,但它并不适用于我,例如更新的" angular / cli"版本或安装enhanced-resolve@3.3.0,但仍然是相同的错误。
这是package.json中的一些内容:
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"animate.css": "3.5.2",
"chart.js": "^2.1.3",
"core-js": "^2.4.1",
"echarts": "^3.6.2",
"enhanced-resolve": "^3.3.0",
"font-awesome": "^4.7.0",
"fullcalendar": "3.3.1",
"jquery": "3.2.1",
"jquery-slimscroll": "1.3.8",
"ng-prism": "^2.3.4",
"ngx-bootstrap": "^1.7.1",
"ngx-echarts": "^1.2.1",
"primeng": "^4.0.0",
"prismjs": "^1.6.0",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.4",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
答案 0 :(得分:0)
您可以通过此命令构建您的作品:
ng build --prod --aot=false -bh /<base-href> -d /<dir>
用您自己的基础href替换<base-href>
,用项目文件夹名称替换<dir>
答案 1 :(得分:0)
正如我comment中提到的那样,如果你没有声明应用程序目录结构中存在的任何组件,那么在较新的angular / cli版本中,它会抛出这种类型的错误:
ERROR in Internal error: unknown identifier 300
ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\Users...\ng-webapp \src' @ ./src/main.ts 3:0-74 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts