![](/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.