在Angular教程(英雄之旅)中遇到的困境我想说

在一直循着Angular官方教程进行学习时,不小心陷入了困境。

环境

    • macOS Mojave(10.14.6)

 

    • Docker

Angular CLI: 8.3.19
Node: 13.1.0
OS: linux x64
Angular: 8.2.14

卡在一处

教程 > 6.HTTP > 模拟数据服务器

スクリーンショット 2019-11-18 16.18.17.png

所以,当我在此页面上输入以下命令时…

#npm install angular-in-memory-web-api --save

这个地方。在导入 RxJS 的时候发生了错误。

import { Observable, of } from 'rxjs';

为什么?

仔细一看,发现当执行 “npm install ~”时,出现了如下警告。

#install angular-in-memory-web-api --save
(中略)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @angular/common@8.2.14 requires a peer of rxjs@^6.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/core@8.2.14 requires a peer of rxjs@^6.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/forms@8.2.14 requires a peer of rxjs@^6.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/router@8.2.14 requires a peer of rxjs@^6.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-in-memory-web-api@0.9.0 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ angular-in-memory-web-api@0.9.0
added 88 packages from 33 contributors, removed 64 packages, updated 1044 packages and audited 20998 packages in 260.873s
found 0 vulnerabilities

版本依赖好像不一样。(大概吧)

策略来解决问题。

那么,我已经放进去这么多了。

# npm install -g npm  /* npmのアップデート */
# npm install rxjs          
# npm install tslib   

关于 npm 命令的详细信息,请参考这里。

由于这样的原因,错误已经成功消失了。

版本变化 huà)

我使用以下的命令来查看,想知道实际版本发生了什么变化。

 # ng version

之前

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.19
@angular-devkit/build-angular     0.803.19
@angular-devkit/build-optimizer   0.803.19
@angular-devkit/build-webpack     0.803.19
@angular-devkit/core              8.3.19
@angular-devkit/schematics        8.3.19
@angular/cli                      8.3.19
@ngtools/webpack                  8.3.19
@schematics/angular               8.3.19
@schematics/update                0.803.19
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

结束了

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.19
@angular-devkit/build-angular     0.803.19
@angular-devkit/build-optimizer   0.803.19
@angular-devkit/build-webpack     0.803.19
@angular-devkit/core              8.3.19
@angular-devkit/schematics        8.3.19
@angular/cli                      8.3.19
@ngtools/webpack                  8.3.19
@schematics/angular               8.3.19
@schematics/update                0.803.19
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

嗯?还没改变?!那么,那个错误是什么?!

…虽然我有点在意,但我还是继续进行一小段的教程吧!

请问我可以参考一下吗?

广告
将在 10 秒后关闭
bannerAds