Windows server 2012 R2
节点v4.7.4 npm v4.3.0
我不能做“服务”:“/ c / Users // AppData / Roaming / npm / ng:没有这样的文件或目录”
我也不能做“npm start”:“意外的令牌{”然后是一个巨大的调用栈。
我尝试过使用各种版本的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开始就好了:
以下是我OSX上的版本:
ng -v
给了我:
angular-cli:1.0.0-beta.16
节点:6.9.4
os:darwin x64
npm -v
给了我:
3.10.10
答案 0 :(得分:6)
尝试升级你的cli版本,beta16之后发生了很多变化。你可以这样做;
npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest
答案 1 :(得分:1)
升级节点和angular-cli
sudo npm install -g n
sudo n latest
sudo npm install -g @angular/cli
答案 2 :(得分:0)
解决方案:
update .npmrc file at C:\Users\{USERNAME}
以下行
prefix=${APPDATA}\npm
这篇文章对我有所帮助: http://itechiesol.blogspot.co.za/2017/07/angular-cli-ng-command-is-not-working.html
答案 3 :(得分:0)
您是否已以管理员的身份全局安装了angular?然后也以管理员身份运行ng命令。