简体   繁体   English

angular2-mdl 404(未找到)

[英]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.

相关问题 找不到清晰度角度(404错误) - clarity-angular not found (404 error) Angular 9 SSR 404 Not Found Page with Status code - Angular 9 SSR 404 Not Found Page with Status code Angular $ resource方法PUT获取在服务器上找不到404 - Angular $resource method PUT gets 404 not found on server 使用angular.js和ExpressJS的POST请求404(未找到) - POST request 404 (Not Found) with angular.js and ExpressJS Angular,找不到图像(GET 404),但在运行 ngbuild 后显示图像 - Angular, image not found (GET 404) but it shows image after running ngbuild POST http://localhost:4200/ 404 未找到(从 Angular 到 Nodejs 的请求) - POST http://localhost:4200/ 404 Not found (Request from Angular to Nodejs) 使用Angular2将JSON发布到节点服务器返回未找到404 URL - JSON Post to Node Server with Angular2 returns 404 URL not found GET 请求图像到 Angular 组件返回 404 Not Found - GET Request for Image to Angular Component returns 404 Not Found 将 Angular 应用程序部署到 Heroku,构建成功,但在浏览器中显示 404 not found - Deploying Angular app to Heroku, build was successful but in browser it shows 404 not found Angular 13 反向代理 web 找不到套接字错误 404 - Angular 13 reverse proxy web socket error 404 not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM