2016-12-01 66 views
0

我正在使用Visual Studio Enterprise 2015 Update 3.我从Online模板创建了一个新项目“Angular2 Mvc5示例应用程序”。Angular2 Mvc5示例应用程序无法编译

当我编译它,我得到了很多类似的错误:

错误TS2307找不到模块“@角/核心”。

错误TS2307找不到'@ angular/http'模块。

错误TS2503找不到命名空间'模型'。

我能做些什么才能编译它而不会出现这些错误?

谢谢!

下面是我的tsconfig.json文件:

{ 
    "compileOnSave": true, 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false 
    }, 
    "exclude": [ 
    "node_modules", 
    "typings/main", 
    "typings/main.d.ts", 
    "Scripts/TypeLite.Net4.d.ts" 
    ] 
} 
+0

你做了npm安装吗? – 12seconds

+0

你使用的是什么版本的nodejs? – user65439

+0

你是否参考:npm install Angular2? –

回答

0

我创建你提到的模板中的项目。使用“右键单击package.json和Restore Packages”没有任何运气,输出中显示的包没有找到404。

因此,我通过命令行做了“npm install”,而且我能够编译得很好。

确保您的目录中存在“node_modules”。

另一件需要注意的是package.json上的包已经过时了。

+0

我通过命令行做了“npm install”,现在一切都很好。谢谢! –