![](/img/trans.png)
[英]How is the Angular framework loaded into an application with Angular CLI?
[英]How to run angular 2 application by angular cli
我正在尝试使用angular 2创建一个应用程序。我从github.w得到一个示例项目文件夹,当我运行该应用程序时,我收到“找不到本地工作空间文件('angular.json')”错误消息。 如何解决这个问题?
的package.json
{
"name": "demo-app",
"version": "1.0.0",
"author": "Aravind",
"description": "set up files for the first Demo App",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.0",
"tslint": "^3.7.4",
"typescript": "^2.0.2",
"typings": "^1.0.4"
},
"repository": {}
}
看来您的Angular CLI是v6 +,而您的Angular App是v2。 您的项目中必须有angular-cli.json
文件。 在最新版本的CLI中,在v6之后,请配置。 angular.json
更改,文件便用angular.json
重命名。 如果是这种情况,请创建angular.json
文件并进行相应的更新。
否则,只需使用ng new <appName>
创建一个新项目,然后按ng serve
。 由于Angular CLI是您计算机上最新安装的,因此默认情况下它将创建angular.json
。
在此处了解有关Angular CLI命令的更多信息。
是的,看来您的Angular项目已过时,最新的Angular使用angular.json
,而不是angular-cli.json
。
要求创建者对其进行更新,或者自己按照以下说明进行操作: https : //update.angular.io/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.