2017-07-15 86 views
1

丟失包的錯誤,我跟着/克隆這種github repo爲什麼我即使我輸入他們在Visual Studio代碼

然後我打開Visual Studio代碼項目。我得到這個錯誤:

錯誤:

'This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'.' at: '13,1' source: 'ts'

'This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'.' at: '13,1' source: 'ts'

'Cannot find name 'OnInit'.' at: '27,41' source: 'ts'

enter image description here

這是源代碼:

import { 
    Component, 
    OnInit, 
} from '@angular/core'; 
/** 
* We're loading this component asynchronously 
* We are using some magic with es6-promise-loader that will wrap the module with a Promise 
* see https://github.com/gdi2290/es6-promise-loader for more info 
*/ 

console.log('`Detail` component loaded asynchronously'); 

@Component({ 
    selector: 'detail', 
    template: ` 
    <h1>Hello from Detail</h1> 
    <span> 
     <a [routerLink]=" ['./child-detail'] "> 
     Child Detail 
     </a> 
    </span> 
    <router-outlet></router-outlet> 
    `, 
}) 
export class DetailComponent implements OnInit { 

    public ngOnInit() { 
    console.log('hello `Detail` component'); 
    } 

} 

enter image description here

附:我已重新打開Visual Studio代碼,但錯誤仍然存​​在。

+0

https://github.com/AngularClass/angular-starter/issues/1819。附:回答包括實際錯誤文本在內的問題更容易,而不是截圖。 – Claies

+0

您的進口報表在哪裏? – Aravind

+0

@Aravind導入語句位於我在此附加的源代碼的頂部 – EntryLeveDeveloper

回答

1

因此,作爲使用的TeamViewer您沒有安裝您的node_modules

安裝,修復您的問題的工作。

+1

感謝您使用teamviewer來調試問題。我很感激。只是不知道爲什麼我忘了做:npm安裝 – EntryLeveDeveloper

+0

@CodeContributor酷。它發生 – Aravind

相關問題