我是Angular2的新手。我正在关注Tutorial Angular2 by Example
。这是第一个简单的教程叫做猜数Angular2 intelliJ配置错误..找不到模块'@ angular/core'
我使用的代码完全按照github提供的示例 https://github.com/chandermani/angular2byexample/tree/master/guessthenumber中所述。
它在浏览器中加载正常。这是IntelliJ安装,我有问题。
IntelliJ返回以下错误..如截图所示。 找不到模块 '@角/核心'
我的属性文件如下
systemjs.config.js
System.config({
map : {
'app': 'app',
'rxjs': 'https://unpkg.com/[email protected]',
'@angular/common': 'https://unpkg.com/@angular/[email protected]',
'@angular/compiler': 'https://unpkg.com/@angular/[email protected]',
'@angular/core': 'https://unpkg.com/@angular/[email protected]',
'@angular/platform-browser': 'https://unpkg.com/@angular/[email protected]',
'@angular/platform-browser-dynamic': 'https://unpkg.com/@angular/[email protected]'
},
packages:{
'app': { main: 'main.ts', defaultExtension: 'ts' },
'@angular/common': { main: 'bundles/common.umd.js', defaultExtension: 'js' },
'@angular/compiler': { main: 'bundles/compiler.umd.js', defaultExtension: 'js' },
'@angular/core': { main: 'bundles/core.umd.js', defaultExtension: 'js' },
'@angular/platform-browser': { main: 'bundles/platform-browser.umd.js', defaultExtension: 'js' },
'@angular/platform-browser-dynamic': { main: 'bundles/platform-browser-dynamic.umd.js', defaultExtension: 'js' },
},
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
transpiler: 'typescript',
typescriptOptions: {
emitDecoratorMetadata: true
}
});
我的上一个潜在的解决方案的想法?
当前加载模块从https://unpkg.com/@angular/[email protected]不过的IntelliJ情愿将其从计算机上的文件被加载?我应该在本地托管文件吗?
Intellij不知道systemjs.config.js文件?我需要创建一个tsconfig.json文件吗? Intellij能理解吗?
查看使用本地模块时的系统配置可能如何:https://github.com/johnpapa/angular-tour-of-heroes/blob/master/system-config.ts – lena
我认为此评论指向正确的方向然而,这个例子有很多我不需要的东西。 –
我解释了Idea中的错误;我提供的链接仅仅是一个例子,而不是一个随时可用的解决方案 – lena