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).

3 Answers 3

9

You could use serve instead of lite-server.

Sign up to request clarification or add additional context in comments.

5 Comments

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 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.
How to run it without node or npm or browser-sync??
you should use another web server if don't want to use node and npm
But with npm serve, when i refresh none-root pages, it's a 404.
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

Comments

-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.