简体   繁体   English

ng serve Angular 2的问题

[英]Issues with ng serve Angular 2

I have a problem with the installation of an existing angular application. 我在安装现有的角度应用程序时遇到问题。

I'm trying to launch the application with the ng serve command, and this error is occurring: The "@angular/compiler-cli" package was not properly installed. Error: reflect-metadata shim is required when using class decorators 我正在尝试使用ng serve命令启动应用程序,并且发生此错误: The "@angular/compiler-cli" package was not properly installed. Error: reflect-metadata shim is required when using class decorators The "@angular/compiler-cli" package was not properly installed. Error: reflect-metadata shim is required when using class decorators . The "@angular/compiler-cli" package was not properly installed. Error: reflect-metadata shim is required when using class decorators

I've installed all the packages provided in the package.json file with the npm install command, I know they are a bit outdated, but they are still supposed to work. 我已经使用npm install命令npm installpackage.json文件中提供的所有软件包,我知道它们有些过时了,但仍然可以使用。

These are all the dev dependencies: 这些都是开发人员依赖项:

"card"                             : "^1.2",
"del"                              : "latest",
"gulp"                             : "latest",
"gulp-autoprefixer"                : "latest",
"gulp-concat"                      : "latest",
"gulp-cssnano"                     : "2.x",
"gulp-eslint"                      : "latest",
"gulp-html5-lint"                  : "latest",
"gulp-htmlmin"                     : "2.x",
"gulp-imagemin"                    : "latest",
"gulp-inline-source"               : "latest",
"gulp-notify"                      : "latest",
"gulp-plumber"                     : "latest",
"gulp-rev-all"                     : "latest",
"gulp-sass"                        : "latest",
"gulp-scss-lint"                   : "latest",
"gulp-sourcemaps"                  : "2.0.0-alpha",
"gulp-svg-sprite"                  : "latest",
"gulp-tslint"                      : "4.x",
"gulp-typescript"                  : "2.x",
"gulp-uglify"                      : "latest",
"gulp-util"                        : "latest",
"merge-stream"                     : "latest",
"tslint"                           : "3.x",
"browser-sync"                     : "2.x",
"connect-history-api-fallback"     : "latest",
"typescript"                       : "1.x",
"typings"                          : "^0.8.1",
"svg4everybody"                    : "2.x",
"jquery"                           : "2.x",
"jasmine"                          : "2.x",
"semantic-ui"                      : "2.x",
"@angular/common"                  : "2.0.0-rc.1",
"@angular/compiler"                : "2.0.0-rc.1",
"@angular/compiler-cli"            : "^2.0.x",
"@angular/core"                    : "2.0.0-rc.1",
"@angular/http"                    : "2.0.0-rc.1",
"@angular/platform-browser"        : "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router"                  : "2.0.0-rc.1",
"@angular/router-deprecated"       : "2.0.0-rc.1",
"@angular/upgrade"                 : "2.0.0-rc.1",
"@angular/cli"                     : "1.4.8",
"systemjs"                         : "0.19.27",
"es6-shim"                         : "^0.35.0",
"reflect-metadata"                 : "^0.1.3",
"rxjs"                             : "5.0.0-beta.6",
"zone.js"                          : "^0.6.12",
"angular2-in-memory-web-api"       : "0.0.7"

Anyone has an idea on how to resolve this? 任何人都有解决此问题的想法? I'm struggling on this because I'm pretty new to Angular, any suggestion is accepted. 我为此感到挣扎,因为我是Angular的新手,任何建议都可以接受。

Thanks in advance. 提前致谢。

要启用angular cli命令,必须通过此命令将其安装在节点的全局区域中

npm install -g angular-cli

我通过此npm install -g angular-cli@1.0.0-beta.28.3解决了(全局安装该版本的cli)

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

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