将ngx-bootstrap 3.0.1升级到4.0.1 [英] Upgrading ngx-bootstrap 3.0.1 to 4.0.1

查看:88
本文介绍了将ngx-bootstrap 3.0.1升级到4.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从ngx引导程序3.0.1升级到4.0.1时出现以下错误.替换了node_modules,package.json仍然出现相同的错误.角版本:

While Upgrading from ngx bootstrap 3.0.1 to 4.0.1 am getting the following error.Replaced the node_modules, package.json still getting the same errors. Angular Version :

Angular 6,
Typescript: 2.7.2.

Errors:
ERROR in node_modules/ngx-bootstrap/chronos/utils/type-checks.d.ts(8,62): error TS2304: Cannot find name 'Extract'.

node_modules/ngx-bootstrap/datepicker/reducer/bs-datepicker.actions.d.ts(5,33): error TS1039: Initializers are not allowed in ambient contexts.

node_modules/ngx-bootstrap/timepicker/reducer/bs-datepicker.actions.d.ts(4,33): error TS1039: Initializers are not allowed in ambient contexts.

图像中的错误

推荐答案

当我使用ngx-editor在Angular中实现RTF编辑器时遇到了此错误

I have encounter this error when I was using ngx-editor to implement rich text editor in Angular

由于较旧版本的Angular和rxjs会发生此错误,就我而言,我使用的是Angular 6和rxjs 6.0.0,然后通过使用以下命令将其更新为Angular 7和rxjs 6.2.0(Typescript还将已更新为打字稿2.9.2)

This error occurs due to older version of Angular and rxjs, In my case I was using Angular 6 and rxjs 6.0.0, then I have updated it to Angular 7 and rxjs 6.2.0 by using below commands (Typescript will also be updated to typescript 2.9.2)

ng update rxjs@~6.2.0
ng update @angular/cli @angular/core

注意:如果您未获得警告

Note: If you are getting below warning

npm警告不要跳过跳过依赖项:fsevents@1.2.7不受支持的平台:想要的{"os":"darwin","arch":"any"}(当前:{"os":"win32," arch:" x64})

,而您想忽略此警告(fsevents@1.2.7 :),则可以使用以下命令

and you want to ignore this warning (fsevents@1.2.7:) you can use below command

   npm i -f

此后,我先卸载了ngx-bootstrap和ngx-editor,然后先安装依赖项软件包,然后重新安装ngx-bootstrap和ngx-editor,如下所述.

After this, I have uninstall ngx-bootstrap and ngx-editor, then first install dependency packages and then reinstall ngx-bootstrap and ngx-editor, as mentioned below steps.

npm i ajv@^6.9.1 --save

npm i font-awesome@^4.7.0 --save

npm i angular-font-awesome

npm install ngx-bootstrap --save

npm install ngx-editor --save

最后,您需要检查HttpClientModule和其他软件包是否正确地导入了app.module.ts

At last, you need to check if HttpClientModule and other packages are properly imported in app.module.ts

import { NgxEditorModule } from 'ngx-editor';
import { AngularFontAwesomeModule } from 'angular-font-awesome';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { HttpClientModule } from '@angular/common/http'; 

imports: [
    BrowserModule,
    AppRoutingModule,
    NgxEditorModule,
    AngularFontAwesomeModule,
    TooltipModule.forRoot(),
    HttpClientModule
  ],

现在已解决,此外,您还可以通过使用ngx-editor使用富文本编辑器

Now it is resolved, In addition you can able to use rich text editor by using ngx-editor

谢谢

这篇关于将ngx-bootstrap 3.0.1升级到4.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆