角度更新警告



我刚刚更新了我的角度项目。一切似乎都很好,除了我收到以下警告:

npm WARN @angular-devkit/build-angular@0.800.2 requires a peer of typescript@>=3.1 < 3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@8.0.0 requires a peer of typescript@>=3.4 <3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@8.0.2 requires a peer of typescript@>=3.4 < 3.5 but none is installed. You must install peer dependencies yourself.

我走进我的package.json,在devDependencies下,我有以下内容:

"typescript": "~3.5.1",

所以我把它改成:

"typescript": "^3.4.0",

然后我删除了node_modules并运行了npm install,但警告仍然存在。命令npm ls typescript返回以下内容:

intergun@0.0.0 C:UsersjbraProgramsintergun
`-- @angular-devkit/build-angular@0.800.2
  `-- @angular-devkit/build-optimizer@0.800.2
    `-- typescript@3.4.4

所以看起来它确实在使用打字稿版本 3.4.4.,它应该满足警告中的要求。

这里有什么问题?我做错了什么吗?

使用应使用 ~ 或 none。当您使用波浪号 ~ 时,它将匹配指定次要版本(第二个数字(的最新修补程序版本(第三个数字(。~3.4.0 将匹配所有 3.4.x 版本。

使用插入符号 ^ 时,它匹配指定主要版本(第一个数字(的最新次要版本(第二个数字(。也就是说,您将使用 ^3.x.x

以下是这些概念的直观解释:

相关内容

最新更新