在新的@ angular/router 3.0.0-alpha.3中找不到ProvideRouter和RouterConfig [英] provideRouter and RouterConfig not found in new @angular/router 3.0.0-alpha.3^
问题描述
我正在将angular2应用迁移到RC2,并尝试使用路由器的3版Alpha.
I am migrating an angular2 app to RC2 and trying to use the router's version 3 alpha.
我遵循了
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中将角度/路线设置为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 '
我仍然会收到错误消息.
I still get the error.
我什至尝试使用alpha.4,alpha.5和最新的alpha.6版本.
I even tried using the alpha.4, alpha.5 and latest alpha.6 version.
我尝试删除nodule模块文件夹并强制npm安装以获取新文件.
I tried deleting the nodule module folder and forcing the npm install to get new files.
问题:
有人可以帮我找出为什么找不到导出的成员 provideRouter , RouterConfig 吗?
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屋!