VS2015:“找不到类型定义"和“找不到文件";错误 [英] VS2015: "Cannot find type definition" and "File not found" errors

查看:1495
本文介绍了VS2015:“找不到类型定义"和“找不到文件";错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Angular2应用程序,直到两天前都运行良好.当我尝试在Visual Studio 2015中构建解决方案时,出现10个错误:

I have an Angular2 app which worked perfectly fine until two days ago. When I tried to build the solution in Visual Studio 2015, I got 10 errors:

Build: Cannot find type definition file for 'hammerjs'.
Build: Cannot find type definition file for 'jasmine'.
Build: File (...)/wwwroot/lib/ng2-translate/index.ts' not found.

还有6个有关ng2-translate中各种文件的信息.

And 6 more about various files in ng2-translate not found.

令人惊讶的是,当我通过dotnet run命令构建我的应用程序时,它运行良好. 我用npm-check-updates -u更新了所有内容,但没有任何改变. 我的package.json:

Surprisingly, when I build my app by dotnet run command, it works well. I updated everything by npm-check-updates -u, but it didn't change anything. My package.json:

{
  "version": "1.0.0",
  "name": "CarMarket",
  "private": true,
  "dependencies": {
    "@angular/common": "~4.0.3",
    "@angular/compiler": "~4.0.3",
    "@angular/core": "~4.0.3",
    "@angular/forms": "~4.0.3",
    "@angular/http": "~4.0.3",
    "@angular/platform-browser": "~4.0.3",
    "@angular/platform-browser-dynamic": "~4.0.3",
    "@angular/router": "~4.0.3",
    "@angular/upgrade": "~4.0.3",
    "angular-in-memory-web-api": "~0.3.1",
    "body-parser": "1.17.1",
    "bootstrap": "3.3.7",
    "chart.js": "^2.5.0",
    "core-js": "^2.4.1",
    "es6-shim": "^0.35.0",
    "fancybox": "3.0.0",
    "jquery": "3.2.1",
    "ng2-charts": "^1.5.0",
    "ng2-translate": "^5.0.0",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.3.0",
    "systemjs": "0.20.12",
    "zone.js": "^0.8.9"
  },
  "devDependencies": {
    "@types/node": "^7.0.13",
    "del": "2.2.2",
    "gulp": "3.9.1",
    "gulp-typescript": "3.1.6",
    "gulp-watch": "4.3.11",
    "merge": "1.2.0",
    "typescript": "^2.0.10",
    "typings": "^2.1.1"
  },
  "scripts": {
    "postinstall": "typings install"
  }
}

这些错误的原因可能是什么?高

What might be the reason of those errors? H

推荐答案

正如错误明确指出的那样,您缺少了Hammerjs和茉莉花的类型定义.您可以将它们添加到类型定义文件中,也可以直接安装类型包:

As the error clearly states, you are missing type definitions for hammerjs and jasmine. You can either add them to your typings definition file, or you can install the types packages directly:

npm install --save @types/hammerjs
npm install --save @types/jasmine

这篇关于VS2015:“找不到类型定义"和“找不到文件";错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆