Solvedangular cli Angular 2 CLI ng build inline.js,styles.bundle.js and main.bundle.js 404 error

Please provide us with the following information:

OS?

Mac OSX (El Capitan)

Versions.

angular-cli: 1.0.0-beta.17
node: 4.6.1
os: darwin x64

Repro steps.

Created a sample application using angular-cli. Ran ng build command to build the app for development.Tried to access index.html under dist folder from the browser.The following errors are seen in console

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/inline.js

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/inline.js

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:63342/styles.bundle.js

Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:63342/main.bundle.js

index.html and above files are under same root.

Please let me know if I am going wrong.

Thanks and Regards,
Durga Prasad Telu.

20 Answers

✔️Accepted Answer

Okay Recently I fetched this problem I have very simple solution for solve this Issue , follow these steps:
go to these directories src-> app-> index.html open the index.html and find
<base href="your app name "> change this to <base href="/">

Other Answers:

I had the same problem,but I fixed it.
If you are using a maven project, you must remeber all static files must be in webapp/resources.
I have my index.html in webapp/ so my base path in index.html is => <base href="./resources/">
to change this path for next builds you must execute ng build --base-href /newpath/
I hope it helps you.

In my case, I had to comment out <base href="/"> to fix the 404 error.

Note*: I'm using Angular CLI version 1.6.5

More Issues: