Angular-cli: [beta.31] ng build -prod produces build with runtime error: "No provider for t!"

Created on 13 Feb 2017  Â·  3Comments  Â·  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Windows 10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

@angular/cli: 1.0.0-beta.31
node: 6.9.5
os: win32 x64
@angular/common: 2.3.1
@angular/compiler: 2.3.1
@angular/core: 2.3.1
@angular/forms: 2.3.1
@angular/http: 2.3.1
@angular/platform-browser: 2.3.1
@angular/platform-browser-dynamic: 2.3.1
@angular/router: 3.1.1
@angular/cli: 1.0.0-beta.31
@angular/compiler-cli: 2.3.1

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

This app was previously working fine with an older version of the CLI (beta.24). Runs fine via "ng serve" or an "ng build" where the target is not production.

The log given by the failure.

Normally this include a stack trace and some more information.

EXCEPTION: No provider for t!
t.handleError @ vendor.f5dba30….bundle.js:662
(anonymous) @ vendor.f5dba30….bundle.js:436
t.invoke @ polyfills.2835132….bundle.js:37
onInvoke @ vendor.f5dba30….bundle.js:331
t.invoke @ polyfills.2835132….bundle.js:37
n.run @ polyfills.2835132….bundle.js:37
(anonymous) @ polyfills.2835132….bundle.js:37
t.invokeTask @ polyfills.2835132….bundle.js:37
onInvokeTask @ vendor.f5dba30….bundle.js:331
t.invokeTask @ polyfills.2835132….bundle.js:37
n.runTask @ polyfills.2835132….bundle.js:37
i @ polyfills.2835132….bundle.js:37

Mention any other details that might be useful.

No errors during build itself. Output looks as expected. Also doesn't matter if aot flag is present or not. Both builds produced by our build server and my local machine produces this error.

chunk    {0} 0.c1aea3a78ff571f641f4.chunk.js 882 kB {1} {2} {3} {4} {6} [rendered]
chunk    {1} 1.aee0ca0904c8abc7330b.chunk.js 531 kB {0} {2} {3} {4} {6} [rendered]
chunk    {2} 2.e23ea99c7f93d7c5b283.chunk.js 373 kB {0} {1} {3} {4} {6} [rendered]
chunk    {3} 3.cd4f382a7c6ca5eb8175.chunk.js 167 kB {0} {1} {2} {4} {6} [rendered]
chunk    {4} 4.8cb3b3d19762f27a492d.chunk.js 24.8 kB {0} {1} {2} {3} {6} [rendered]
chunk    {5} polyfills.2835132090ace95ff78b.bundle.js (polyfills) 222 kB {9} [initial] [rendered]
chunk    {6} main.1ed543b10f95c9a4e302.bundle.js (main) 598 kB {8} [initial] [rendered]
chunk    {7} styles.6408559673a4d7d00e2b.bundle.css (styles) 228 bytes {9} [initial] [rendered]
chunk    {8} vendor.f5dba30503ece8a48681.bundle.js (vendor) 2.73 MB [initial] [rendered]
chunk    {9} inline.c7e475387731490a2976.bundle.js (inline) 0 bytes [entry] [rendered]

Thanks! We'll be in touch soon.

Most helpful comment

One thing to factor in is that AoT is now always on in prod builds, whether you specify it or not.

So, to ensure whether this happens in non AoT builds, try ng build -prod --aot=false.

If this is the problem, you might get more debug info from running ng build --aot (dev env + AoT), or just bringing sourcemaps in prod like ng build -prod --sourcemaps (sourcemaps are also turned off by default in prod)

Try this and see if you can get more information about what's upsetting it.

Cheers,.

All 3 comments

One thing to factor in is that AoT is now always on in prod builds, whether you specify it or not.

So, to ensure whether this happens in non AoT builds, try ng build -prod --aot=false.

If this is the problem, you might get more debug info from running ng build --aot (dev env + AoT), or just bringing sourcemaps in prod like ng build -prod --sourcemaps (sourcemaps are also turned off by default in prod)

Try this and see if you can get more information about what's upsetting it.

Cheers,.

That explains it. Thanks! I'll give your suggestion a shot. Closing.

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._

Was this page helpful?
0 / 5 - 0 ratings