简体   繁体   English

angular 2.0 cli项目没有导出的mng'RouterConfig'

[英]angular 2.0 cli project no exported mng 'RouterConfig'

I started an angular 2.0 project with angular CLI; 我用角度CLI开始了一个角度2.0项目; but when I tried to use routing it is throwing some errors. 但是当我尝试使用路由时,它会抛出一些错误。 Currently when I try to run 'npm serve' the error showing is - 目前,当我尝试运行'npm serve'时,显示的错误是 -

"The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with: Error: Typescript found the following errors: H:/codes/animeSquad/tmp/broccoli_type_script_compiler-input_base_path-XUPT7Vob.tmp/0/src/app/app.routes.ts (5, 10): Module '"H:/codes/animeSquad/node_modules/@angular/router/index"' has no exported mng 'RouterModule'." “Broccoli插件:[BroccoliTypeScriptCompiler]失败了:错误:Typescript发现了以下错误:H:/codes/animeSquad/tmp/broccoli_type_script_compiler-input_base_path-XUPT7Vob.tmp/0/src/app/app.routes.ts(5, 10):模块'“H:/ codes / animeSquad / node_modules / @ angular / router / index”'没有导出的mng'RouterModule'。“

My package.json content is as such - 我的package.json内容是这样的 -

{
    "name": "anime-squad",
    "version": "0.0.0",
    "license": "MIT",
    "angular-cli": {},
    "scripts": {
        "start": "ng serve",
        "postinstall": "typings install",
        "lint": "tslint \"src/**/*.ts\"",
        "test": "ng test",
        "pree2e": "webdriver-manager update",
        "e2e": "protractor"
    },
    "private": true,
    "dependencies": {
        "@angular/common": "^2.0.0-rc.5",
        "@angular/compiler": "2.0.0-rc.5",
        "@angular/core": "2.0.0-rc.5",
        "@angular/forms": "0.3.0",
        "@angular/http": "2.0.0-rc.5",
        "@angular/platform-browser": "2.0.0-rc.5",
        "@angular/platform-browser-dynamic": "2.0.0-rc.5",
        "@angular/router":  "3.0.0-alpha.7",
        "@angular/upgrade": "2.0.0",
        "es6-shim": "0.35.1",
        "reflect-metadata": "0.1.3",
        "rxjs": "5.0.0-beta.6",
        "systemjs": "0.19.31",
        "zone.js": "0.6.12"
    },
    "devDependencies": {
        "angular-cli": "1.0.0-beta.10",
        "codelyzer": "0.0.20",
        "ember-cli-inject-live-reload": "1.4.0",
        "jasmine-core": "2.4.1",
        "jasmine-spec-reporter": "2.5.0",
        "karma": "0.13.22",
        "karma-chrome-launcher": "0.2.3",
        "karma-jasmine": "0.3.8",
        "protractor": "3.3.0",
        "ts-node": "0.5.5",
        "tslint": "3.11.0",
        "typescript": "1.8.10",
        "typings": "1.3.1"
    }
}

My target is to enable routing while keeping the CLI setup. 我的目标是在保持CLI设置的同时启用路由。 I am fairly new to angular so simple detailed explanation will be much appreciated. 我是一个相当新的角度,所以简单的详细解释将非常感激。

Thanks in advance. 提前致谢。

Use "@angular/router" : "^3.0.0-rc.1" with angular rc5 and if possible try with latest version of angular release as angular 2.0.0 is released. 使用"@angular/router" : "^3.0.0-rc.1" ,角度为rc5,如果可能,请尝试使用最新版本的角度释放,因为角度为2.0.0 You can see answer of question to update to latest angular version : how to upgrade to angular2 official release from rc6 from webpack 你可以看到问题的答案更新到最新的角度版本: 如何从webpack升级到rc6的angular2官方版本

RC.2 is shipped with the RC router, which has been deprecated. RC.2附带RC路由器,已被弃用。 You need to install the vladivostok router :) 你需要安装vladivostok路由器:)

npm remove @angular/router --save // will remove the RC router npm install @angular/router@3.0.0-alpha.7 --save // will install the latest router npm remove @angular/router --save //将删除RC路由器npm install @angular/router@3.0.0-alpha.7 --save //将安装最新的路由器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM