@ angular / compiler-cli @ 5.2.0需要typescript @'> = 2.4.2< 2.6.0'但是找到了2.6.2

时间:2018-01-16 08:57:54

标签: angular typescript npm angular-cli

如何为已经创建的Angular项目克服此问题?我想使用2.6.2 Typescript

@angular/compiler-cli@5.2.0 requires typescript@'>=2.4.2 <2.6.0' but 2.6.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
    npm install typescript@'>=2.4.2 <2.6.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler-cli'*

1 个答案:

答案 0 :(得分:1)

问题很明显......你的角度CLI版本需要一个Typescript低版本。

您需要降级您的Typescript版本。

在你的package.json中更改:

"typescript": "^2.6.2",

"typescript": "^2.4.2",

并运行

npm install