在新的@angular/router 3.0.0-alpha.3^ 中找不到 provideRouter 和 RouterConfig [英] provideRouter and RouterConfig not found in new @angular/router 3.0.0-alpha.3^

查看:23
本文介绍了在新的@angular/router 3.0.0-alpha.3^ 中找不到 provideRouter 和 RouterConfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个 angular2 应用程序迁移到 RC2 并尝试使用路由器的版本 3 alpha.

I am migrating an angular2 app to RC2 and trying to use the router's version 3 alpha.

我已按照 angular docs 用于路由但我不断收到以下错误:

I have followed the set up of the plunker given by the angular docs for routing But i keep getting the following errors:

/@angular/router/index"' 没有导出成员 'provideRouter'

/@angular/router/index"' has no exported member 'provideRouter'

/@angular/router/index"' 没有导出成员 'RouterConfig'

/@angular/router/index"' has no exported member 'RouterConfig'

尝试在我的 app.router.ts 文件中使用以下导入时:

when trying to use the following imports in my app.router.ts file:

import { provideRouter, RouterConfig } from '@angular/router';

我在 Visual Studio 中使用具有 commonjs 模块格式的打字稿.

I am using typescript in visual studio with commonjs module format.

这里是我的packages.json的依赖

Here are the dependecies from my packages.json

"@angular/common": "2.0.0-rc.2",
"@angular/compiler": "2.0.0-rc.2",
"@angular/core": "2.0.0-rc.2",
"@angular/http": "2.0.0-rc.2",
"@angular/platform-browser": "2.0.0-rc.2",
"@angular/platform-browser-dynamic": "2.0.0-rc.2",
"@angular/router": "3.0.0-alpha.3",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.2",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.12"

即使我在 system.config.js 中将 angular/route 设置为 npm cdn,如下所示:

Even if I set the angular/route to the npm cdn in my system.config.js like so:

'@angular/router': 'https://npmcdn.com/@angular/router@3.0.0-alpha.3'

'@angular/router': 'https://npmcdn.com/@angular/router@3.0.0-alpha.3'

我仍然收到错误消息.

我什至尝试使用 alpha.4、alpha.5 和最新的 alpha.6 版本.

I even tried using the alpha.4, alpha.5 and latest alpha.6 version.

我尝试删除结节模块文件夹并强制 npm install 获取新文件.

I tried deleting the nodule module folder and forcing the npm install to get new files.

问题:

谁能帮我弄清楚为什么找不到导出的成员provideRouterRouterConfig?

Can someone help me figure out why the exported memebers provideRouter, RouterConfig can not be found?

谢谢

推荐答案

我遇到了同样的问题,使用 3.0.0-alpha.7 版解决了

I had the same issue, solved it with using Version 3.0.0-alpha.7

这里是我的 package.json:

Here my package.json:

"dependencies": {
"@angular/common":  "2.0.0-rc.2",
"@angular/compiler":  "2.0.0-rc.2",
"@angular/core":  "2.0.0-rc.2",
"@angular/http":  "2.0.0-rc.2",
"@angular/platform-browser":  "2.0.0-rc.2",
"@angular/platform-browser-dynamic":  "2.0.0-rc.2",
"@angular/router":  "3.0.0-alpha.7",
"@angular/upgrade":  "2.0.0-rc.2",
"systemjs": "0.19.31",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.12",
"bootstrap": "^3.3.6",
"contentful": "3.3.14"}

虽然我不会称之为稳定和新文档 https://angular.io/docs/ts/latest/guide/router.html 可能有点误导.

Altough I wouldn't call it stable and the new Documentation https://angular.io/docs/ts/latest/guide/router.html can be bit missleading.

这篇关于在新的@angular/router 3.0.0-alpha.3^ 中找不到 provideRouter 和 RouterConfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆