Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in running examples/cli #47

Closed
deepakzoto opened this issue Jun 12, 2017 · 16 comments
Closed

Error in running examples/cli #47

deepakzoto opened this issue Jun 12, 2017 · 16 comments

Comments

@deepakzoto
Copy link

deepakzoto commented Jun 12, 2017

[info] Rendering application from source (working path: C:\Users\DEEPAK~1.KUM\AppData\Local\Temp\8a64d5de8297)
Unhandled Promise rejection: Hash: 78b6a7ffed306051892e
Version: webpack 2.4.1
Time: 5845ms
Asset       Size  Chunks  Chunk Names
 0.js  989 bytes       0  app\app.module
chunk    {0} 0.js (app\app.module) 448 bytes [entry] [rendered]
 [Cos1] ./src/app/app.module.ts 420 bytes {0} [built] [failed] [1 error]
    [0] multi ./app/app.module.ts 28 bytes {0} [built]

ERROR in ./src/app/app.module.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:9514:20)
    at Object.createCompilerHost (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:63770:26)
    at Object.ngcLoader (D:\GitWork\web-ui\node_modules\@ngtools\webpack\src\loader.js:380:33)
 @ multi ./app/app.module.ts ; Zone: <root> ; Task: Promise.then ; Value: { Error: Hash: 78b6a7ffed306051892e
Version: webpack 2.4.1
Time: 5845ms
Asset       Size  Chunks  Chunk Names
 0.js  989 bytes       0  app\app.module
chunk    {0} 0.js (app\app.module) 448 bytes [entry] [rendered]
 [Cos1] ./src/app/app.module.ts 420 bytes {0} [built] [failed] [1 error]
    [0] multi ./app/app.module.ts 28 bytes {0} [built]

ERROR in ./src/app/app.module.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:9514:20)
    at Object.createCompilerHost (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:63770:26)
    at Object.ngcLoader (D:\GitWork\web-ui\node_modules\@ngtools\webpack\src\loader.js:380:33)
 @ multi ./app/app.module.ts
    at CompilerException.Exception [as constructor] (D:\GitWork\web-ui\node_modules\angular-ssr\source\exception.ts:6:5)
    at new CompilerException (D:\GitWork\web-ui\node_modules\angular-ssr\build\exception.js:63:42)
    at D:\GitWork\web-ui\node_modules\angular-ssr\source\application\compiler\webpack\compiler.ts:92:18
    at onCompiled (D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\Compiler.js:239:14)
    at D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\Compiler.js:494:13
    at next (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:138:11)
    at Compiler.<anonymous> (D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\CachePlugin.js:62:5)
    at Compiler.applyPluginsAsyncSeries (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:142:13)
    at D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\Compiler.js:491:10
    at next (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin (D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\@angular\cli\plugins\suppress-entry-chunks-webpack-plugin.js:35:17)
    at Compilation.applyPluginsAsyncSeries (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:142:13)
    at self.applyPluginsAsync.err (D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\Compilation.js:645:19)
    at Compilation.applyPluginsAsyncSeries (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:131:46)
    at self.applyPluginsAsync.err (D:\GitWork\web-ui\node_modules\angular-ssr\node_modules\webpack\lib\Compilation.js:636:11)
    at next (D:\GitWork\web-ui\node_modules\tapable\lib\Tapable.js:138:11)
  innerException: undefined,
  __zone_symbol__currentTask:
   ZoneTask {
     _zone:
      Zone {
        _properties: {},
        _parent: null,
        _name: '<root>',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data: undefined,
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } } Error: Hash: 78b6a7ffed306051892e
Version: webpack 2.4.1
@JPM84
Copy link

JPM84 commented Jun 22, 2017

Same Problem here.

@JPM84
Copy link

JPM84 commented Jun 22, 2017

After updating the example/cli package.json modules via ncu the resulting error-message is as follows:
Unhandled Promise rejection: Chunk app/app.module does not have associated output files

@JPM84
Copy link

JPM84 commented Jun 24, 2017

Just tried the 0.10.16 update. The error still exists, but great to see the examples/cli project being updated.

@DmitryEfimenko
Copy link

Also experiencing this error. Please use my repository if you need one to reproduce the error

@clbond
Copy link
Contributor

clbond commented Jun 26, 2017

Hi guys. This is the critical error that is causing the problem:


ERROR in ./src/app/app.module.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:9514:20)
    at Object.createCompilerHost (D:\GitWork\web-ui\node_modules\typescript\lib\typescript.js:63770:26)
    at Object.ngcLoader (D:\GitWork\web-ui\node_modules\@ngtools\webpack\src\loader.js:380:33)
 @ multi ./app/app.module.ts

You should not be using @ngtools/webpack to compile the application in server-side rendering mode. There are issues with it. Instead, use ts-loader, angular2-template-loader, and angular-router-loader. ngtools should only be used for AoT builds. ng-render is not considered an AoT build. All AoT optimizations should be disabled when doing ng-render.

I will try to track down what the source of this problem is, but if you want to solve it now, only enable @ngtools/webpack when process.env.NODE_ENV === 'production'. Otherwise use the loader chain I described above.

@clbond
Copy link
Contributor

clbond commented Jun 26, 2017

Oh, you are just using the CLI ... ok, investigating

@clbond
Copy link
Contributor

clbond commented Jun 26, 2017

OK, this was indeed a bug. The webpack integration code was thrown off by the fact that the module had more than one output (0.js and 0.js.map). It should exclude the map file. This is fixed in 0.10.19.

@DmitryEfimenko I was able to build your repo with the 0.10.19 fixes:

Bond-MacBook:wez1 bond$ npm run prerender

> no-drainer@0.0.0 prerender /Users/bond/wez1
> ng-render --debug

[info] Rendering application from source (working path: /var/folders/k9/ww5nrgyx687gpx7s_86tf37m0000gn/T/015fb193a3bb8) 
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
[info] Rendered route / to /Users/bond/wez1/dist/index.html 
[info] Rendered route /about to /Users/bond/wez1/dist/about/index.html 
[info] Rendered route /testimonials to /Users/bond/wez1/dist/testimonials/index.html 
[info] Rendered route /testing to /Users/bond/wez1/dist/testing/index.html 
[info] Rendered route /contact to /Users/bond/wez1/dist/contact/index.html 

@clbond
Copy link
Contributor

clbond commented Jun 26, 2017

Please verify that 0.10.19 fixes this issue for you.

@JPM84
Copy link

JPM84 commented Jun 26, 2017

Thx for the quick update.
Prerendering ist working, but the output is white pages for me when I run it.
All prerender pages consist of:

<!DOCTYPE html><html><head></head>
     <body>
   </body></html>

I tried it also with the example project of @DmitryEfimenko.

@JPM84
Copy link

JPM84 commented Jun 26, 2017

Just tried building the project without AOT (ng build --aot=false). Same result.

@DmitryEfimenko
Copy link

I tried prerendering after upgrading angular-ssr to 0.10.19 and got the same error. At this time I had angular-cli 1.0.3.

After upgrading angular-cli to the latest, which is at the moment 1.1.3, and building project, the prerender command does not throw an error, but the contents of prerendered .html files are -- just like @JPM84 mentioned:

<!DOCTYPE html><html><head></head>
     <body>
   </body></html>

@clbond
Copy link
Contributor

clbond commented Jun 26, 2017

Yes, I screwed up. That bug with the empty document is fixed in 0.10.21. I apologize @DmitryEfimenko @JPM84

@DmitryEfimenko
Copy link

works great! Thanks for quick fix!

@JPM84
Copy link

JPM84 commented Jun 26, 2017

Yeah! 0.10.22 rocks 🎉! No problem we all been there 😁 !
My project pipeline is green again 😄.
Thanks for the amazing work!
It's definitely the easiest way to prerender an angular application.

@clbond
Copy link
Contributor

clbond commented Jun 27, 2017

Cool! Thanks for the bug report guys. I really appreciate your help!

@clbond clbond closed this as completed Jun 27, 2017
@ericel
Copy link

ericel commented Jul 14, 2017

I am having this with angularfire2 when I run npm run build

[info] Rendering application from source (working path: C:\Users\S\AppData\Local\Temp\47aec918d3)
Unhandled Promise rejection: n.removeEventListener is not a function ; Zone: <root> ; Task: Promise.then ; Value: { TypeError: n.removeEven
tListener is not a function
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:28:843
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:28:880
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:277:366
    at Object.eo/D (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:278:2)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.RVyb (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:6968:72)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.+rnp (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:316:89)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.Cos1 (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:6442:76)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.32 (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:3524:18)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:65:1
    at Object.<anonymous> (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:65:1)
    at Module._compile (module.js:570:32)
  __zone_symbol__currentTask:
   ZoneTask {
     _zone:
      Zone {
        _properties: {},
        _parent: null,
        _name: '<root>',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data: undefined,
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } } TypeError: n.removeEventListener is not a function
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:28:843
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:28:880
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:277:366
    at Object.eo/D (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\~\firebase\auth.js:278:2)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.RVyb (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:6968:72)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.+rnp (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:316:89)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.Cos1 (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:6442:76)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at Object.32 (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\0.js:3524:18)
    at e (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:19:1)
    at C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:65:1
    at Object.<anonymous> (C:\Users\S\AppData\Local\Temp\47aec918d3\webpack:\webpack\bootstrap 9f2c19ec88d22c4d7cc6:65:1)
    at Module._compile (module.js:570:32)

Any thing I can do to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants