[英]rxjs version error while running npm install
I was working on a new Angular App. 我正在开发一个新的Angular App。 I created that using Angular CLI with
ng new.
我使用
ng new.
使用Angular CLI创建了它ng new.
When I tried to lauch that app using npm start , I got following error : 当我尝试使用npm start启动该应用程序时,出现以下错误:
ERROR in node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ';' expected.
node_modules/rxjs/internal/types.d.ts(81,74): error TS1005: ';' expected.
node_modules/rxjs/internal/types.d.ts(81,77): error TS1109: Expression expected.
I inspected the dependencies using ng -version
inside that project and found below output. 我在该项目内使用
ng -version
检查了依赖项,并在输出下面找到了。
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 7.2.1
@angular/cli 6.0.8
@angular/material 7.2.1
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.3.3
typescript 2.7.2
webpack 4.8.3
I had another Angular app installed on my machine . 我的机器上安装了另一个Angular应用程序。
I ran ng -version
again in this app giving below result. 我在这个应用程序中再次运行
ng -version
,结果如下。
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.4.0
typescript 2.7.2
webpack 4.8.3
Comapring the results , I got below difference 匹配结果,我得到以下差异
App Giving error has 应用提供错误有
rxjs 6.4.0
And App running fine has 而且App运行良好
rxjs 6.3.3
I changed the rxjs version in not running app to below in package.json
like below : 我将不运行应用程序的rxjs版本更改为
package.json
以下内容,如下所示:
"rxjs": "6.3.3"
and the problem got resolved 问题解决了
So I have below questions , can anybody please answer these ? 所以我有以下问题,有人可以回答吗?
1)I am not able to analyse why downgrading rxjs version
resolved the issue ? 1)我无法分析为什么降级
rxjs version
解决此问题? Since all other component versions are the same in both the apps . 由于两个应用程序中的所有其他组件版本都相同。 First app (not running one uses angular material as addition)
第一个应用程序(未运行的应用程序使用角形材质作为附加)
2)I had two apps to compare the versions . 2)我有两个应用程序来比较版本。 Had it not been the case , is there any way to find out this error is due to rxjs downgrading of version ?
如果不是这种情况,是否有任何方法可以找出此错误是由于rxjs版本降级引起的?
Answer 1 & 2 : Downgrading rxjs version resolved bcz you're using a old compiler version. 答案1和2:降级rxjs版本已解决,因为您正在使用旧的编译器版本。
Find yours at package.json
CTRL+F
typescript
在
package.json
找到您所需的CTRL+F
typescript
Try installing the newest version of typescript: 尝试安装最新版本的打字稿:
npm install -g typescript@latest.
You can also use npm update
instead of install, without the latest modifier. 您也可以使用
npm update
而不是install,而无需使用最新的修饰符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.