When to use 'npm start' and when to use 'ng serve'?

后端 未结 5 1461
离开以前
离开以前 2020-12-02 05:19

ng serve serves an Angular project via a development server

 

npm start runs an ar

5条回答
  •  -上瘾入骨i
    2020-12-02 05:31

    If you want to run angular app ported from another machine without ng command then edit package.json as follows

    "scripts": {
        "ng": "ng",
        "start": "node node_modules/.bin/ng serve",
        "build": "node node_modules/.bin/ng build",
        "test": "node node_modules/.bin/ng test",
        "lint": "node node_modules/.bin/ng lint",
        "e2e": "node node_modules/.bin/ng e2e"
      }
    

    Finally run usual npm start command to start build server.

提交回复
热议问题