[英]angular2-mdl 404 (Not Found)
I am getting strange error 404 not found error . 我收到奇怪的错误404 not found error。 I have properly installed angular2-mdl with
npm install angular2-mdl --save
and I can find it easily inside in node_modules directory 我已经使用
npm install angular2-mdl --save
正确安装了angular2-mdl,我可以在node_modules目录中轻松找到它
here is my app.module.ts 这是我的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 { }
I also want to mention that when it run npm start
I get no error. 我还要提及的是,当它运行
npm start
我不会出错。
But when I run in browser I get 404 error and in console I can see it is pointing towards http://localhost:3000/angular2-mdl
and I know it should be http://localhost:3000/node_modules/angular2-mdl
I don't know why it is happening . 但是,当我在浏览器中运行时,出现404错误,在控制台中,我看到它指向
http://localhost:3000/angular2-mdl
,我知道它应该是http://localhost:3000/node_modules/angular2-mdl
我不知道为什么会这样。
How to fix this error 如何解决这个错误
Please comment if more info is required 如果需要更多信息,请发表评论
After debugging in several ways I found the error was in systemjs.config.js
在以几种方式进行调试后,我发现错误出在
systemjs.config.js
I have to add 我必须添加
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
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.