为什么我即使我输入他们在Visual Studio代码

问题描述:

丢失包的错误,我跟着/克隆这种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

因此,作为使用的TeamViewer您没有安装您的node_modules

安装,修复您的问题的工作。

+1

感谢您使用teamviewer来调试问题。我很感激。只是不知道为什么我忘了做:npm安装 – EntryLeveDeveloper

+0

@CodeContributor酷。它发生 – Aravind