我收到奇怪的错误404未找到错误。我已经用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,但我不知道为什么会发生这种情况。
如何修复此错误
如果需要更多信息,请留言
发布于 2017-09-29 18:26:04
通过几种方式进行调试后,我发现错误出在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
},https://stackoverflow.com/questions/46469911
复制相似问题