【发布时间】:2021-03-09 16:59:10
【问题描述】:
“ng serve”命令出现以下错误。我刚刚从 git 中提取了这个,删除了 node_modules 和 package-lock 文件,运行了 npm install 然后 ng serve。我不知道这意味着什么,之前似乎没有其他人遇到过这个问题
Error: TypeError: Cannot read property 'createUniqueName' of undefined
at
...\Web\Web\node_modules\@ngtools\webpack\src\transformers\replace_bootstrap.js:54:50
at Array.forEach (<anonymous>)
at standardTransform
(...\Web\Web\node_modules\@ngtools\webpack\src\transformers\replace_bootstrap.js:32:32)
at transformer (...\Web\Web\node_modules\@ngtools\webpack\src\transformers\make_transform.js:17:25)
replace_bootstrap.js:54:50 看起来像这样:
const idPlatformBrowser = ts.factory.createUniqueName('__NgCli_bootstrap_');
replace_bootstrap.js:32:32 是这样的:
entryModuleIdentifiers.forEach(entryModuleIdentifier => {
// Figure out if it's a `platformBrowserDynamic().bootstrapModule(AppModule)` call.
if (!(entryModuleIdentifier.parent
&& entryModuleIdentifier.parent.kind === ts.SyntaxKind.CallExpression)) {
return;
}
const callExpr = entryModuleIdentifier.parent;
if (callExpr.expression.kind !== ts.SyntaxKind.PropertyAccessExpression) {
return;
【问题讨论】:
标签: angular npm angular-cli