Solvedangular cli scripts.bundle.js net::ERR_ABORTED

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0
Node: 8.8.0
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cli: 1.5.0
@angular/language-service: 4.4.4
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

When I run 'ng serve --aot` it gives me this error:
GET http://localhost:4200/scripts.bundle.js net::ERR_ABORTED

and because I have included jquery it has problem referencing it.
ERROR ReferenceError: $ is not defined

I checked Network on Dev tools and scripts.bundle.js is NOT FOUND

The log given by the failure.

Desired functionality.

Today I upgraded the project to angular@5 and angular-cli@1.5 .
Prior to this, it did not happen.

Mention any other details that might be useful.

41 Answers

✔️Accepted Answer

This happens when you use Electron and change index.html <base href="/"> to <base href="./">

Just add useHash:true in your route module

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    RouterModule.forRoot(routes, { useHash: true })  // .../#/your-route/
  ]...

Other Answers:

I got the same error updating angular 4 to 5 and cli 1.4.7 to 1.5
I fixed it running:
npm cache verify
I hope that will solve your problem too.

I had the same issue. Running npm cache clean seems to have resolved it.

For me, the error only appears in the following situation:
Using ng serve with no flags
The first compilation fails (due to a compile error)
Subsequent build passes (compile error fixed)
==> the scripts.bundle.js file is not generated.

When I abort the ng serve command and restart it, the file is generated as expected.

Node: 6.11.2
Npm: 5.5.1
Typescript: 2.3.4
@angular/cli: 1.5.0 (also occurred in 1.4.9)

Same here. I did not use AOT on serve.

More Issues: