ng generate - (node:12988)fs:不支持重新评估本机模块源。

时间:2016-06-10 15:41:07

标签: angularjs angular-ui-router

我正在尝试使用visual studio 2015应用程序中的typescript构建一个角度2应用程序。我正在使用角度释放候选人1。

我目前正在尝试为我的应用程序配置路由。当我执行命令ng generate route welcome时,我收到以下错误

  (node:12988) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
    installing route
    Cannot read property 'sourceDir' of undefined
    TypeError: Cannot read property 'sourceDir' of undefined

我尝试使用命令

安装最新版本的graceful-fs
npm i graceful-fs@latest

但是当我运行命令检查版本时,我看到了

npm info graceful-fs -v
3.8.9

当我运行命令查看宽限安装列表时,我看到

npm ls graceful-fs

+-- angular-cli@1.0.0-beta.5
| `-- ember-cli@2.5.0
|   +-- npm@2.14.21
|   | `-- graceful-fs@4.1.3
|   `-- yam@0.0.18
|     `-- fs-extra@0.16.5
|       `-- graceful-fs@3.0.8
`-- graceful-fs@4.1.4

有人可以告诉我问题是什么,因为我无法弄明白。

app组件如下

import { Component } from '@angular/core';
import { DataTable, Column } from 'primeng/primeng';
import { Router } from  '@angular/router';
import { ROUTER_PROVIDERS, Routes, ROUTER_DIRECTIVES } from  '@angular/router';
import { WelcomeComponent } from  './components/home/welcome.component';
import { RiskListComponent } from './components/risks/risk-list.component';
import { RiskDetailsComponent } from './components/risks/risk-detail.component';

@Component({
    selector: 'my-app',

    template: `
    <div>
        <h1>{{pageTitle}}</h1>
          <rm-risks> </rm-risks> 
    </div>
    <div>
      <router-outlet>  </router-outlet>
    </div>
     ` ,
    directives: [RiskListComponent, DataTable, Column, ROUTER_DIRECTIVES],
    providers: [ROUTER_PROVIDERS]
})
@Routes([
        { path: '/welcome' , component: WelcomeComponent },
        { path: '/risks', component: RiskListComponent },
        { path: '/riskdetails', component: RiskDetailsComponent }
])
export class AppComponent {
    pageTitle: string = 'Test UK Trader';
}

main.ts组件是

import { bootstrap } from '@angular/platform-browser-dynamic';
import { RiskService } from './components/risks/risk.service';
import { HTTP_PROVIDERS } from  '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
// import 'rxjs/Rx'; this will load all features
import { enableProdMode } from '@angular/core';
// Our main component
import { AppComponent } from './app.component';



bootstrap(AppComponent, [HTTP_PROVIDERS, RiskService]).catch(err => console.error(err));

0 个答案:

没有答案