我正在尝试使用angular 2创建一个应用程序。我从github获得了一个示例项目文件夹。当我运行该应用程序时,我收到“找不到本地工作空间文件('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": {}
}
答案 0 :(得分:0)
看起来您的Angular CLI是v6 +,而您的Angular应用程序是v2。您的项目中必须有angular-cli.json
个文件。在最新版本的CLI中,在v6之后,请配置。稍作更改后,文件将重命名为angular.json
。如果是这种情况,请创建angular.json
文件并进行相应的更新。
否则,只需使用ng new <appName>
创建一个新项目,然后点击ng serve
。由于Angular CLI是您计算机上最新安装的,因此默认情况下它将创建angular.json
。
详细了解Angular CLI命令here。
答案 1 :(得分:0)
是的,看来您的Angular项目已过时,最新的Angular使用angular.json
,而不是angular-cli.json
。
要么要求创建者对其进行更新,要么自己遵循以下步骤进行操作:https://update.angular.io/