2

In angular 7, On running the dist on local machine , for the first time web page is loading. And when on reloading or hit the url, the page throwing the error.

I am used this link to run on the local machine

How to run the Dist Folder on Local Machine in Angular 6?

On Reload and for hit the url I am using .htaccess file. but Its not work.

  • I took the template build with command ng build --prod

  • I changed in index.html href="/browser/"

  • For run on the local machine I am used http-server.

    First install the package globally using command

    npm install http-server -g.

    Then inside the project directory(in the terminal) just run

    http-server dist/.
    

For the first time web page is loading on the local machine and when on reloading or hit the url, the page throwing the server error.

Nikita Garg
  • 157
  • 1
  • 2
  • 11

1 Answers1

0

Put below line in angular.json file, then try.

"deployUrl": "dist/",

Above line put like this.

"architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "public/dist",
        "deployUrl": "dist/",

Thanks

Ghanshyam
  • 265
  • 1
  • 2
  • 11