【问题标题】:@types/angular-resource takes old version of @types/angular@types/angular-resource 采用旧版本的 @types/angular
【发布时间】:2020-02-06 12:20:49
【问题描述】:

在我的 package.json 中,我有以下条目:

"devDependencies": {
        "@types/angular": "1.6.56",
        "@types/angular-resource": "1.5.15"
...

在 node_modules/@types/angular-resource/node_modules/@types/angular/package.json 这个:

    "name": "@types/angular",
    "version": "1.6.55"

所以这些版本之间存在不匹配? angular-resource 将此作为依赖项:

"dependencies": {
        "@types/angular": "*"
    }

所以它匹配每个版本。但是为什么我指定 1.6.56 需要 1.6.55 呢?

我不确定这是否是我在运行 tsc 时出现问题的根本原因:

error TS2694: Namespace 'angular' has no exported member 'resource'.

如果是这样,我该如何解决这个问题?

【问题讨论】:

    标签: angularjs typescript npm dependencies


    【解决方案1】:

    解决方案是删除 node_modules 文件夹并再次使用 npm add/install 手动添加依赖项,突然 v 1.6.55 不见了。仅仅删除 node_modules 文件夹和/或 yarn.lock 是不够的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-06
      • 2014-01-16
      • 2019-02-22
      • 1970-01-01
      • 2019-02-06
      • 1970-01-01
      • 2017-12-04
      相关资源
      最近更新 更多