angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Production bundle error after very small edit from seed app

Open tranvansang opened this issue 9 years ago • 12 comments

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.4.2
node: 8.5.0
os: linux x64
@angular/animations: 4.4.2
@angular/common: 4.4.2
@angular/compiler: 4.4.2
@angular/core: 4.4.2
@angular/forms: 4.4.2
@angular/http: 4.4.2
@angular/platform-browser: 4.4.2
@angular/platform-browser-dynamic: 4.4.2
@angular/router: 4.4.2
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.2
@angular/language-service: 4.4.2
typescript: 2.3.4

Repro steps.

ng new test-app

cd test-app

yarn

ng serve --environment=prod --host 0.0.0.0 --prod --aot

Browse http://localhost:4200, site works

Edit src/app/app.module.ts to add ReactiveFormsModule

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Edit src/app/app.component.html

<input [formControl]="helloFC">

Edit src/app/app.component.ts

import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  helloFC = new FormControl('');
}

Browse http://localhost:4200, site not work

The log given by the failure.

Error: No provider for e!
    at E (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at O (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at t._throwOrNull (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at t._getByKeyDefault (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at t._getByKey (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at t.get (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at je (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at t.get (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at fn (vendor.3de0515ca8e2c20f1562.bundle.js:1)
    at cn (vendor.3de0515ca8e2c20f1562.bundle.js:1)

Desired functionality.

Site should work without any error

Mention any other details that might be useful.

tranvansang avatar Sep 19 '17 09:09 tranvansang

Same issue here with a bigger app. Seems like a compatibility issue with Angular 4.4.X. Switching back to Angular 4.3.6 resolves temporarily the issue.

prismsoundzero avatar Sep 19 '17 12:09 prismsoundzero

I worked on a real project, had this issue, bisect until very first commit and came up with this smallest edit from the seed app to make the bug easier to be seen

tranvansang avatar Sep 19 '17 13:09 tranvansang

It's Angular issue, not CLI.

devoto13 avatar Sep 19 '17 15:09 devoto13

@tranvansang Can you confirm that your app is working after updating to 4.4.3 or greater per @devoto13's comment/link?

Brocco avatar Sep 22 '17 19:09 Brocco

@Brocco ng --version result

@angular/cli: 1.4.3
node: 8.5.0
os: linux x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.3
@angular/compiler-cli: 4.4.3
@angular/language-service: 4.4.3
typescript: 2.3.4

Now thing works as expected

tranvansang avatar Sep 24 '17 16:09 tranvansang

@tranvansang Than close this issue, please.

devoto13 avatar Sep 26 '17 09:09 devoto13

@tranvansang what small change did you do to clear the error could you please help me out

nayanasrirama avatar Dec 06 '17 14:12 nayanasrirama

@nayanasrirama upgrade @angular and @angular/cli only did not fix the problem. What I did was yarn upgrade or npm update followed by @angular @angular/cli @angular/compile-cli... everything appears in ng --version result.

Hope this help

======= update

yarn add and npm install looks better than just upgrade or update

tranvansang avatar Dec 07 '17 04:12 tranvansang

@tranvansang yarn command isn't working so i did npm update and i have the latest angular cli and angular versions but still the error appears can you please help me out

nayanasrirama avatar Dec 07 '17 12:12 nayanasrirama

@nayanasrirama can you paste ng --version's output, your package.json content. And what is your problem? paste your terminal error output. if possible please tell how did you reproduce the error

tranvansang avatar Dec 07 '17 14:12 tranvansang

@tranvansang No the problem is fixed thank you for your time

nayanasrirama avatar Dec 08 '17 11:12 nayanasrirama

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.