7

In my package.json I have the following:

...
"scripts": {
        "tsc": "tsc",
        "tsc:w": "tsc -w --outDir build",
        "lite": "lite-server",
        "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
    },
...

and I was wondering how could I start the app using "npm production" or something similar?

I'd want to prevent browsersync from running: I just tried with multiple users and it was hilarious to see that they were scrolling "as one". This also happens accross different browsers (but not using different tabs).

PascalVKooten
  • 20,643
  • 17
  • 103
  • 160

3 Answers3

9

You could use serve instead of lite-server.

kemsky
  • 14,727
  • 3
  • 32
  • 51
  • 1
    I did `npm install --save serve` and added the line `"serve": "serve",` under "scripts" in package.json. Then I was able to use `npm run serve`. – PascalVKooten Apr 13 '16 at 17:04
  • @PascalvKooten You can also install `serve` globally so that you do not have to keep a local copy in every project of yours. For this package, you will not require different versions across multiple projects. – Mani Oct 12 '16 at 07:00
  • How to run it without node or npm or browser-sync?? – Jyotirmay Nov 02 '16 at 10:42
  • you should use another web server if don't want to use node and npm – kemsky Nov 02 '16 at 11:26
  • 1
    But with npm serve, when i refresh none-root pages, it's a 404. – Martin Cremer Jan 16 '17 at 00:33
1

Use the npm start. In newly installed Angular app with ng new <name_of_app>, the package.json file has the settings for that

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  }

So using npm start will run ng serve and the browser sync does not run browsersync

olaoluwa_98
  • 304
  • 1
  • 9
-1

you can use http-server (npm install -g http-server) then in your project directory http-serve -p [port]

Vojtech Ruzicka
  • 16,384
  • 15
  • 63
  • 66