答案 0 :(得分:0)
首先确保将angular cli安装为
npm install -g @angular/cli
-g使其全局安装,然后您可以运行命令。
ng -v
或者你可以在devDependencies json中更新package.json中的@ angular / cli
这
"angular-cli": "anything"
到
"@angular/cli": "1.3.2"
答案 1 :(得分:0)
DEMO目录中的package.json
在dev依赖项中没有列出angular@cli
:
...
"devDependencies": {
"@angular/cli": "^1.3.0", // <--- Here is the local project package.
"@angular/compiler-cli": "^4.0.0",
"@types/highcharts": "^5.0.4",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0",
"webpack-bundle-analyzer": "^2.8.2"
}
...
您应该安装本地和全球@angular/cli
软件包。
使用npm install -g @angular/cli@latest
和npm install @angular/cli@latest --save-dev
顺便说一下,当您安装angular/@cli
并使用ng new
命令时,它会自动为您的项目下载所有依赖项,包括@angular/cli
。