Windows Server 2012 R2
node v4.7.4 npm v4.3.0
我不能做一个“ng服务”:“/c/Users//AppData/Roaming/npm/ng:没有这样的文件或目录”
我也不能使用“npm start”:“Unexpected token {”然后是一个巨大的调用堆栈。
我尝试过使用各种版本的node/npm/cli等。我哪儿也去不了。
我的应用程序的project.json文件:
{
"name": "my-proj",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve --env=source",
"build": "ng build",
"build-replace": "ng build --env=replace",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/compiler-cli": "2.2.4",
"@angular/core": "2.0.0",
"@angular/flex-layout": "2.0.0-beta.3",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/material": "2.0.0-alpha.10",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"angular2-select": "1.0.0-alpha.12",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"jsrsasign": "6.1.1",
"jwt-decode": "2.1.0",
"lodash": "4.16.4",
"material-design-lite": "1.2.1",
"moment": "2.15.1",
"ng2-pagination": "0.5.1",
"ng2-translate": "4.0.0",
"normalize.css": "4.2.0",
"primeng": "1.0.0-rc.6",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "1.1.1",
"xmljson": "0.2.0",
"zone.js": "0.6.23"
},
"devDependencies": {
"@types/jasmine": "2.2.30",
"@types/lodash": "4.14.37",
"angular-cli": "1.0.0-beta.16",
"codelyzer": "0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.0.2",
"karma-remap-istanbul": "0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
字符串
在我的OSX机器上,我可以很好地执行npm start:
以下是我的OSX版本:ng -v
给我:
角线:1.0.0-beta.16
节点:6.9.4
操作系统:达尔文x64npm -v
给我:
3.10.10
6条答案
按热度按时间dffbzjpn1#
试着升级你的cli版本,在beta16之后发生了很多变化。你可以这样做;
字符串
ktca8awb2#
如果你在Mac上,在终端上;别加'--'。只需键入[ng version]。
z4iuyo4d3#
升级node和angular-cli
字符串
xzlaal3s4#
解决方法:
字符串
用下面的线
型
这篇文章帮助了我:http://itechiesol.blogspot.co.za/2017/07/angular-cli-ng-command-is-not-working.html
hgc7kmma5#
从本地和全局帐户中清除旧的CLI。
从本地帐户删除
字符串
从全局帐户中删除
型
在全局帐户中重新安装
型
设置环境变量
型
关闭并打开cmd以验证ng v
ekqde3dh6#
是否以Administrator身份全局安装angular?然后以管理员身份运行ng命令。