将 Angular 8 项目更新为 Angular 9 时,出现错误
\n\xe2\x9c\x94 Package successfully installed.\nUsing package manager: 'npm'\nCollecting installed dependencies...\nFound 0 dependencies.\nPackage '@angular/core' is not a dependency.\nRun Code Online (Sandbox Code Playgroud)\n我使用的命令
\nng update @angular/core@9 @angular/cli@9 --force\nRun Code Online (Sandbox Code Playgroud)\n 我安装了 angular 9
Angular CLI:9.0.1 节点:13.8.0 操作系统:win32 x64
角度:...常春藤工作区:
套餐版本
@angular-devkit/architect 0.900.1
@angular- devkit /core 9.0.1
@angular-devkit/schematics 9.0.1
@schematics/angular 9.0.1
@schematics/update 0.900.1
rxjs 6.5.3
每次我尝试使用 ng new 创建一个新项目时,我都会收到消息
安装包... npm WARN deprecated request@2.88.2: request 已被弃用,参见https://github.com/request/request/issues/3142 npm ERR!解析 '...pm-signature":"-----B' npm ERR 附近时,JSON 输入意外结束!可以在以下位置找到此运行的完整日志:npm ERR!C:\Users\Lijo John Daniel\AppData\Roaming\npm-cache_logs\2020-02-12T09_52_57_342Z-debug.log × 包安装失败,见上。原理图工作流失败。看上面。
我尝试重新安装 angular 甚至 node,但问题仍然存在
我的操作系统版本是 Win 10 v.1909 build 18363.592。有人可以帮我弄这个吗?
看起来 Angular Ivy 还没有准备好。我正在尝试使用 ivy 构建我的项目,这是 Angular 9 的主要思想。许多库与此功能不兼容,其中一个库是@angular/flex-layout. Material 和 service-worker 也有同样的问题。
使用ng build --prod --aot -c=production脚本构建我的项目后,我得到:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/media-trigger/media-trigger.d.ts:71:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).
71 static ?fac: ?ngcc0.??FactoryDef<MediaTrigger>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:18:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).
18 static ?fac: ?ngcc0.??FactoryDef<ShowHideStyleBuilder>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:49:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).
49 static ?fac: ?ngcc0.??FactoryDef<ShowHideDirective>;
Run Code Online (Sandbox Code Playgroud)
错误比我上面写的要长,我花时间仔细搜索了这个问题,除了禁用常春藤,这不是一个好的选择。
当我运行 npm run start 时,出现以下有关 firebase 的错误。
技术:Angular 版本 9、Firebase、Firestore、Geofirestore Angular CLI。
错误:
ERROR in The target entry-point "@angular/fire/auth" has missing dependencies:
- firebase/auth
- firebase/app
Run Code Online (Sandbox Code Playgroud)
需要注意的依赖:
"@angular/cli": "~9.1.1",
"@angular/core": "~9.1.1",
"@angular/fire": "^5.1.1",
"firebase": "5.10.1",
"geofirestore": "3.2.3",
Run Code Online (Sandbox Code Playgroud)
包 json:
{
"name": "project",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
},
"private": true,
"dependencies": {
"@agm/core": "^1.1.0",
"@angular/animations": "~9.1.1",
"@angular/cdk": "^9.2.0",
"@angular/common": "~9.1.1", …Run Code Online (Sandbox Code Playgroud) 我们有一个带有测试的 Angular 8 项目。我们正在尝试升级到 Angular 9 并完成了https://update.angular.io/#8.0:9.0l3 中的所有步骤。这一切都很顺利,没有任何问题。该应用程序编译没有错误,所有测试运行良好。我们在运行时收到此错误。当我们关闭常春藤时,它运行良好,所以肯定与常春藤有关。
zone-evergreen.js:659 Unhandled Promise rejection: Cannot read property 'id' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'id' of undefined
at registerNgModuleType (core.js:35467)
at core.js:35485
at Array.forEach (<anonymous>)
at registerNgModuleType (core.js:35481)
at core.js:35485
at Array.forEach (<anonymous>)
at registerNgModuleType (core.js:35481)
at new NgModuleFactory$1 (core.js:35649)
at compileNgModuleFactory__POST_R3__ (core.js:41403)
at PlatformRef.bootstrapModule (core.js:41768) TypeError: Cannot read property 'id' of undefined
at registerNgModuleType (http://localhost:8080/vendor.js:41436:27)
at http://localhost:8080/vendor.js:41454:14
at Array.forEach (<anonymous>)
at …Run Code Online (Sandbox Code Playgroud) 我跑了
ng version
Run Code Online (Sandbox Code Playgroud)
并得到以下输出:
Angular CLI: 9.0.3
Node: 12.16.1
OS: win32 x64
Angular: 9.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.25
@angular-devkit/build-angular 0.803.25
@angular-devkit/build-optimizer 0.803.25
@angular-devkit/build-webpack 0.803.25
@angular-devkit/core 8.3.25
@angular-devkit/schematics 9.0.3
@angular/cdk 8.2.3
@angular/cli 9.0.3
@angular/material 8.2.3
@ngtools/webpack 8.3.25
@schematics/angular 9.0.3
@schematics/update 0.900.3
rxjs 6.5.4
typescript 3.8.2
webpack 4.39.2
Run Code Online (Sandbox Code Playgroud)
如果我尝试将类型脚本设置得较低,它会抱怨该项目是 Angular 9 并且不能使用该类型的类型脚本。不知道该怎么做,欢迎任何帮助,谢谢。
我正在从 Angular 8.2 升级到 9.1,并且我正在尝试将私有字段更改为TS 3.8#fieldName: any所允许的而不是. 我得到编译器错误说private fieldName: any
私有标识符仅在针对 ECMAScript 2015 及更高版本时可用。
tsconfig.json:
{
"compilerOptions": {
"module": "esnext"
"target": "es2015",
}
}
Run Code Online (Sandbox Code Playgroud)
包.json:
"devDependencies": {
"typescript": "3.8.3"
}
Run Code Online (Sandbox Code Playgroud) 我研究了 Angular 9 中的新 i18n 功能。https://angular.io/guide/i18n
如何翻译 TypeScript 中的文本,例如 SnackBar 消息?
Im not sure what is happening here but i am receiving this error 'Cannot declare 'FormsModule' in an NgModule as it's not a part of the current compilation' when importing 'formsModule' and 'reactiveformsmodule'into my app.module component.
I am running angular 9 and have tried clearing the cache, reinstalling npm. Could these be an angular 9 issue ? would downgrading to 8 fix the problem...
I am confused as to what is going on here as it imported fine the day …
考虑以下组件:
@Component({
selector: 'app-test'
template: 'Hello!'
}}
export class TestComponent {
@Output() readonly selectionChange = new EventEmitter<SomeTypeHere>();
}
Run Code Online (Sandbox Code Playgroud)
随着电话:
<app-test (selectedChange)="selectedChangeHandler($event)"></app-test>
Run Code Online (Sandbox Code Playgroud)
请注意,我写的selectedChange不是正确的输出名称selectionChange。strictTemplates启用标志的 Angular 9根本没有帮助我。它默默地失败了。有趣的是,如果我对 做同样的事情@Input,应用程序会捕获错误并且不会编译。
如果我试图“听”一个不存在的东西,有什么办法可以抛出错误@Output吗?
angular ×10
angular9 ×10
npm ×2
angular-cli ×1
angular8 ×1
angularfire ×1
firebase ×1
html ×1
ivy ×1
javascript ×1
node.js ×1
typescript ×1