我无法让Angular5基本上设置并运行。
在我的主目录中
$ sudo npm install @angular/cli -g
$ ng new my-verbsandvocab
$ cd my-verbsandvocab
$ ng serve
这给了我错误信息,
Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again.
npm 3.10.10
版本2.6.2
的package.json
{ ......
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.6.3",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
我看不出这个设置有什么问题。我最近一直在玩打字稿并安装。这会影响Angular的安装吗?
解
$ sudo npm install
以超级用户身份运行npm install实现了技巧
答案 0 :(得分:0)
$ sudo npm install
以超级用户身份运行npm install实现了技巧
答案 1 :(得分:0)
$ sudo npm install @angular/cli -g
命令工作正常但不是第一次,你必须得到该使用命令的最新cli
$ sudo npm install --save-dev @angular/cli@latest
然后它会正常工作。 有关详细信息,请查看此 [Angular Video],这有助于我创建我的第一个有角度的5应用程序。