【问题标题】:angular2-mdl 404 (Not Found)angular2-mdl 404(未找到)
【发布时间】:2018-03-10 05:49:14
【问题描述】:

我收到奇怪的错误 404 not found 错误。我已经用npm install angular2-mdl --save 正确安装了angular2-mdl,我可以在node_modules 目录中轻松找到它

这是我的 app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import {HttpModule} from '@angular/http';
import {FormsModule} from '@angular/forms';
import {MdlModule} from 'angular2-mdl';
import {AppComponent} from './app.component';
import {TasksComponent} from './components/tasks/tasks.component';

@NgModule({
  imports:      [ BrowserModule,HttpModule,FormsModule,MdlModule ],
  declarations: [AppComponent, TasksComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

我还想提一下,当它运行 npm start 时,我没有收到任何错误。

但是当我在浏览器中运行时出现 404 错误,在控制台中我可以看到它指向 http://localhost:3000/angular2-mdl,我知道它应该是 http://localhost:3000/node_modules/angular2-mdl 我不知道为什么会这样。

如何解决这个错误

如果需要更多信息,请评论

【问题讨论】:

    标签: node.js angular angular2-mdl


    【解决方案1】:

    通过多种方式调试后发现错误在systemjs.config.js

    我要补充

    map: {
      // our app is within the app folder
      app: 'app',
      // angular bundles
      'angular2-mdl': 'npm:angular2-mdl/bundle/angular2-mdl.js', //added this
      // other libraries
    
    },
    

    【讨论】:

      猜你喜欢
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 1970-01-01
      • 2017-08-06
      • 2017-03-02
      • 2017-02-14
      • 1970-01-01
      相关资源
      最近更新 更多