question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The "ng build" dist html file is compiling incorrectly

See original GitHub issue

Please go to the below link to StackOverflow and see the correct (green check marked) answer for a good explanation

http://stackoverflow.com/questions/37558656/angular-clis-ng-build-doesnt-produce-a-working-project

question title: “Angular CLi’s “ng build” doesn’t produce a working project?”

correct question answer:

change:
<base href="/">

to:
<base href="./">

Versions.

angular-cli 1.0.0 on Linux and macOSsierra, that I’m aware of.

Desired functionality.

should load angular js instead just loads html This appears to be a bug.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
totallytotallyamazingcommented, May 8, 2017

Heya @filipesilva Thanks for your response sorry for any delay in my response, I didn’t see yours till just now. I’m not sure if what you’re saying is true for me or not. My localhost for test serving which has many sub folders works fine with <base href="/"> but on my live web server which also has many sub folders <base href="./"> is required in order for things to serve properly. Perhaps this is because my live web server is a shared Linux server as opposed to a dedicated one, I’m not sure.

Anyway my issue is cleared up now and I’m very happy with the angular-cli project so far. I know from my searches that I’m not the only one who has encountered this issue so hopefully this information helps someone else.

1reaction
filipesilvacommented, May 5, 2017

Heya @totallytotallyamazing, when you run ng build you get a bunch of file that you can deploy to a server.

There’s a couple of things your server needs to do to server Angular apps however. We detail that in https://angular.io/docs/ts/latest/guide/deployment.html#!#server-configuration.

I don’t know the details of your server, but you might also need configure the base tag if you’re serving from a subfolder: https://angular.io/docs/ts/latest/guide/deployment.html#!#base-tag

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in production build: Index html generation failed [closed]
It occurs on generating the final index.html. This is a compilation error probably in the css/scss files (as the typescript seem to compile...
Read more >
Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >
Deployment - Angular
On the first terminal, run the ng build command in watch mode to compile the application to the dist folder. ng build --watch....
Read more >
Deploying an application - Angular
Deploying your application is the process of compiling, or building, your code and hosting the JavaScript, CSS, and HTML on a web server....
Read more >
4 changes that help you improve your new Angular project
First thing that I noticed is that the build is not set to prod mode, and this can be changed with one simple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found