Node.js 角度2无法匹配任何路线:';dist/client.toSubscriber.js.map';
我正在使用作为起点构建Angular 2应用程序。我使用的是Angular 2 rc3: 这是my package.json中的内容:Node.js 角度2无法匹配任何路线:';dist/client.toSubscriber.js.map';,node.js,angular,Node.js,Angular,我正在使用作为起点构建Angular 2应用程序。我使用的是Angular 2 rc3: 这是my package.json中的内容: "dependencies": { "@angular/common": "2.0.0-rc.3", "@angular/compiler": "2.0.0-rc.3", "@angular/core": "2.0.0-rc.3", "@angular/http": "2.0.0-rc.3", "@angular/pla
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/platform-server": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.8",
"angular2-universal": "~0.104.1",
"parse5": "^1.5.0",
"body-parser": "^1.15.1",
"express": "^4.13.4",
"preboot": "^2.1.2",
"rxjs": "5.0.0-beta.6",
"angulartics2": "^1.1.1"
},
当我运行我的应用程序时,在运行npm run server
之后,我会在控制台中看到这一点
我的路线是:
export const routes: RouterConfig = [
{ path: 'about', component: AboutComponent },
{ path: '', component: HomepageComponent, terminal: true }
];
它似乎没有引起任何问题,我的所有路由都按预期工作。我是否应该关注错误,如果是,如何调试原因?我遇到了相同的问题,我通过将默认路由定义添加到RouterConfig定义中解决了这个问题。对于你来说,如果你想让about页面成为你的默认页面,那么这可能类似于下面的内容 {路径:'',重定向到:'/about',路径匹配:'full'} 只需将其添加为数组中的第一个条目,错误就会消失 此外,terminal:true在最新路由器中已被弃用,并替换为pathMatch:“full”
我希望这会有所帮助。我遇到了同样的问题,我通过将默认路由定义添加到RouterConfig定义中解决了这个问题。对于你来说,如果你想让about页面成为你的默认页面,那么这可能类似于下面的内容 {路径:'',重定向到:'/about',路径匹配:'full'} 只需将其添加为数组中的第一个条目,错误就会消失 此外,terminal:true在最新路由器中已被弃用,并替换为pathMatch:“full” 我希望这有帮助