Inside my Angular 5 app , i ve angular-cli 1.6.8
{
"name": "test",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"karma": "ng test",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.7",
"@angular/mon": "^5.2.7",
"@angular/piler": "^5.2.7",
"@angular/core": "^5.2.7",
"@angular/forms": "^5.2.7",
"@angular/http": "^5.2.7",
"@angular/platform-browser": "^5.2.7",
"@angular/platform-browser-dynamic": "^5.2.7",
"@angular/platform-server": "^5.2.7",
"@angular/router": "^5.2.7",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.12.0",
"moment": "^2.18.1",
"npm": "^5.2.0",
"proxy-polyfill": "^0.1.7",
"rxjs": "^5.5.6",
"sha1": "^1.1.1",
"smoothscroll-polyfill": "^0.3.5",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.8"
},
"devDependencies": {
"@angular/cli": "1.6.8",
"@angular/piler-cli": "^5.2.7",
"@types/jasmine": "2.5.38",
"@types/jest": "^20.0.5",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"jest": "^20.0.4",
"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-jest": "^20.0.7",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "2.6.2"
},
}
when running ng --version or ng build inside my app folder , it fails saying that : bash: ng: mand not found
-> in contrats running npm run build
runs normally
i ve node 8.0.0 and npm 4.2.2 installed globally , buti ve not angular-cli installed globally , and i don't want to install it. therfore i think that i may use ng mands inside my app (locally) , no ?
if not how may i do it without installing it globally via npm install -g @angular/cli
(as i m not allowed to run global npm install actions)
Sugesstions?
Inside my Angular 5 app , i ve angular-cli 1.6.8
{
"name": "test",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"karma": "ng test",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.7",
"@angular/mon": "^5.2.7",
"@angular/piler": "^5.2.7",
"@angular/core": "^5.2.7",
"@angular/forms": "^5.2.7",
"@angular/http": "^5.2.7",
"@angular/platform-browser": "^5.2.7",
"@angular/platform-browser-dynamic": "^5.2.7",
"@angular/platform-server": "^5.2.7",
"@angular/router": "^5.2.7",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.12.0",
"moment": "^2.18.1",
"npm": "^5.2.0",
"proxy-polyfill": "^0.1.7",
"rxjs": "^5.5.6",
"sha1": "^1.1.1",
"smoothscroll-polyfill": "^0.3.5",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.8"
},
"devDependencies": {
"@angular/cli": "1.6.8",
"@angular/piler-cli": "^5.2.7",
"@types/jasmine": "2.5.38",
"@types/jest": "^20.0.5",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"jest": "^20.0.4",
"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-jest": "^20.0.7",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "2.6.2"
},
}
when running ng --version or ng build inside my app folder , it fails saying that : bash: ng: mand not found
-> in contrats running npm run build
runs normally
i ve node 8.0.0 and npm 4.2.2 installed globally , buti ve not angular-cli installed globally , and i don't want to install it. therfore i think that i may use ng mands inside my app (locally) , no ?
if not how may i do it without installing it globally via npm install -g @angular/cli
(as i m not allowed to run global npm install actions)
Sugesstions?
Share Improve this question asked Apr 10, 2018 at 10:45 firasKoubaafirasKoubaa 6,87729 gold badges87 silver badges163 bronze badges 2-
5
npm run build
works because it calls./node_modules/.bin/ng
. You could justalias
that, or symlink it into/usr/local/bin
. – jonrsharpe Commented Apr 10, 2018 at 10:48 - Thanks @jonrsharpe. I had been looking for this. Saved my day!! – Quest Commented Feb 10, 2019 at 15:54
1 Answer
Reset to default 6If you want to use ng
mand as well other mands, you need to install them globally. You can't run local mands because NodeJS does not find them.