可能是由于安装ngx-cookie时出现了版本依赖问题,我们可以尝试手动安装依赖项并重新安装ngx-cookie。
下面是解决问题的几个步骤:
确认你所处的工程使用的Angular版本,可以在 package.json
文件中查看。
手动安装 @angular/core
的依赖版本。假设使用的 @angular/core
版本是 ^8.0.0
,那么可以运行以下命令:
npm install @angular/animations@^8.0.0 @angular/common@^8.0.0 @angular/compiler@^8.0.0 @angular/core@^8.0.0 @angular/forms@^8.0.0 @angular/platform-browser@^8.0.0 @angular/platform-browser-dynamic@^8.0.0 zone.js@^0.9.1 rxjs@^6.4.0
npm install ngx-cookie@^4.0.0
ng serve