我是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