paiego
paiego

Reputation: 3787

Angular project in GIT. Can't develop locally

There is an angular project in a GIT repo. From a vanilla system (Mac OS-X Mojave 10.14.6) I'd like to clone it, install whatever Angular components are required, and continue dev on the project but I can't seem to get a dev environment working.

npm version 6.10.2 node version 10.16.2

I clone the repo and using bash, navigate into the directory with package.json.

$npm install
$ng serve

-bash: /usr/local/bin/ng: No such file or directory

From what I understand, npm install should install whatever I need.

This is the contents of my package.json.

{
  "name": "ng-dsl-edit",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.0.4",
    "@angular/cdk": "^7.1.1",
    "@angular/common": "~7.0.0",
    "@angular/compiler": "~7.0.0",
    "@angular/core": "~7.0.0",
    "@angular/forms": "~7.0.0",
    "@angular/http": "~7.0.0",
    "@angular/material": "^7.1.1",
    "@angular/platform-browser": "~7.0.0",
    "@angular/platform-browser-dynamic": "~7.0.0",
    "@angular/router": "~7.0.0",
    "ace-diff": "^2.3.0",
    "core-js": "^2.5.4",
    "diff-match-patch-ts": "^0.2.0",
    "hammerjs": "^2.0.8",
    "ngx-diff": "^0.1.1",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.6",
    "@angular/compiler-cli": "^8.2.8",
    "@angular/language-service": "~7.0.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.3.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.1"
  }
}

Upvotes: 0

Views: 504

Answers (2)

Toan Quoc Ho
Toan Quoc Ho

Reputation: 3378

You could to use npm start instead of ng serve.


Why that happen?

Because on your environment there is no ng in global scope so you will get that error. You can also run npm install -g @angular/cli to make it available in global scope.


Why npm start works?

Inside package.json, you can see there are some commands inside script block. With that, nodejs will find the binary file in local scope (inside folder node_modules/.bin), you've ran npm install already so that ng will available in local scope.

Hope that helps!

Upvotes: 2

Adrian Brand
Adrian Brand

Reputation: 21658

You need to install the Angular cli globally.

npm install -g @angular/cli

or

npm install -g @angular/[email protected]

Seeing you have a 7 project

Upvotes: 0

Related Questions