【发布时间】:2020-04-23 22:02:47
【问题描述】:
我正在尝试从 Angular 8 更新到 9 (Ivy)。我正在尝试使用使用 Angular 8 编译的共享库。我添加了:
"postinstall":"ngcc"
在我的 package.json 中并尝试运行 ngcc。每次它给我以下错误:
TypeError: fn(...).finally is not a function
at AsyncLocker.<anonymous> (...../node_modules/@angular/compiler-cli/ngcc/src/locking/async_locker.js:44:63)
at step (.../node_modules/tslib/tslib.js:139:27)
at Object.next (.../node_modules/tslib/tslib.js:120:57)
at fulfilled (.../node_modules/tslib/tslib.js:110:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
at Function.Module.runMain (module.js:696:11)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project-ng@1.0.0 postinstall: `ngcc`
npm ERR! Exit status 1
npm ERR!
我已尝试删除 node_modules,重新安装 npm 并尝试,但错误仍然存在。
这是我的 tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"module": "ES2015",
"lib": [
"es2015",
"dom"
],
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"importHelpers": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"node_modules",
"dist",
"src/**/*.spec.ts",
"src/**/*.e2e.ts",
"**/*.ngfactory.ts"
],
"angularCompilerOptions": {
"entryModule": "./src/app/app.module#AppModule",
"skipMetadataEmit": true
}
}
欢迎对此提供任何帮助。 谢谢。
【问题讨论】:
-
我做的另一件事是安装了最新的tslib。
-
...为什么要运行 ngcc..?
-
我正在尝试使用一个使用 Angular 8 编译的共享库。
-
Ivy 会自动为你做这件事.. 只需运行 ng serve..?
-
它不是基于 CLI 的项目。
标签: angular angular9 angular-ivy