1.3.0 causes build to fail with - Cannot read property 'range' of null
Bug Report or Feature Request (mark with an x)
- [x ] bug report -> please search issues before submitting
Versions.
ng --version: 1.3.0 npm --version: 5.3.0 node --version: 8.1.4
Repro steps.
I have lazy loaded routes and feature modules ng build --aot --prod
The log given by the failure.
ERROR in chunk 7
[id].[chunkhash:20].chunk.js
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:118:14)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:97:24)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:106:24)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:110:25)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:97:24)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:106:24)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:97:24)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:106:24)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:110:25)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
at getPathInAst (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:110:25)
at enterNode (C:\Users\fabriece\Documents\GitHub\hapi\orange\node_modules\webpack\lib\optimize\ConcatenatedModule.js:121:18)
Desired functionality.
Aot build without errors
Mention any other details that might be useful.
Same issue here on 1.3.0, .1, and .2. @rodolfojnn's suggestion worked as a solution.
Like everyone else is saying @rodolfojnn's solution worked for me as well.
I had the same error but the problem was an unnecessary comma in validators array:
'city': [null, [Validators.required, , Validators.pattern(/[a-zA-Z\'\- ]/)]]
changed it to
'city': [null, [Validators.required, Validators.pattern(/[a-zA-Z\'\- ]/)]]
and everything compiles with ng build --prod --build-optimizer
@tzachov Many thanks, exactly the same solution for me.
Why is this issue closed? Isn't this a bug of angular-cli?
@kimamula the solutions provided here were sufficient for me. That's why I closed the issue. 😂
I'm still getting this on @angular/cli 1.6.6.
I am experiencing this issue in multiple projects using the latest CLI version (1.6.6).
As a workaround, I am avoiding the issue by disabling the build optimizer:
ng build --build-optimizer false
Same problem, helped return to older package versions. It look we have to stay on older packages. :-(
Same issue with cli 1.6.6 ...
ng build --prod
ERROR in chunk main [initial]
[name].[chunkhash:20].bundle.js
Cannot read property 'range' of null
at enterNode (C:\Users\aksjer\Desktop\front\node_modules\webpack\lib\optimize\ConcatenatedModule.js:146:17)
But works with
ng build --prod --aot=true --build-optimizer false
Same here...
ERROR in chunk main [initial]
[name].[chunkhash:20].bundle.js
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
at enterNode (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:146:15)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:125:24)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:134:24)
at enterNode (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:149:18)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:138:25)
at enterNode (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:149:18)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:125:24)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:134:24)
at enterNode (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:149:18)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:125:24)
at getPathInAst (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:134:24)
at info.moduleScope.variables.forEach.variable (C:\Projects\test\node_modules\webpack\lib\optimize\ConcatenatedModule.js:536:23)
at Array.forEach (
Compiles with -> ng build -prod --aot=false but at runtime error inline.78473abd5c48b764ac05.bundle.js:1 Uncaught TypeError: Cannot read property 'call' of undefined at o (inline.78473abd5c48b764ac05.bundle.js:1) at Object.cDNt (main.30cba308dd9fc462669e.bundle.js:1) at o (inline.78473abd5c48b764ac05.bundle.js:1) at Object.0 (main.30cba308dd9fc462669e.bundle.js:1) at o (inline.78473abd5c48b764ac05.bundle.js:1) at window.webpackJsonp (inline.78473abd5c48b764ac05.bundle.js:1) at main.30cba308dd9fc462669e.bundle.js:1 o @ inline.78473abd5c48b764ac05.bundle.js:1 cDNt @ main.30cba308dd9fc462669e.bundle.js:1 o @ inline.78473abd5c48b764ac05.bundle.js:1 0 @ main.30cba308dd9fc462669e.bundle.js:1 o @ inline.78473abd5c48b764ac05.bundle.js:1 window.webpackJsonp @ inline.78473abd5c48b764ac05.bundle.js:1 (anonymous) @ main.30cba308dd9fc462669e.bundle.js:1
Failing also in non production build at runtime: bootstrap aac2077a138753afc283:54 Uncaught TypeError: Cannot read property 'call' of undefined at __ webpack_require__ (bootstrap aac2077a138753afc283:54) at Object.../../../../../src/main.ts (main.ts:1) at __ webpack_require__ (bootstrap aac2077a138753afc283:54) at Object.0 (main.bundle.js:2991) at __ webpack_require__ (bootstrap aac2077a138753afc283:54) at webpackJsonpCallback (bootstrap aac2077a138753afc283:25) at main.bundle.js:1
at: function __ webpack_require__(moduleId) {
on line: modules[moduleId].call(module.exports, module, module.exports, __ webpack_require__);
where moduleId: ../../../core/esm5/core.js
me too. if I downgraded Angular from 5.2.2 to 5.2.1 and it works. Other apps I'm working on do build with angular 5.2.2 and cli 1.6.6..
Having the same issue. Using: Angular CLI: 1.6.6 Node: 8.9.0 OS: darwin x64 Angular: 5.2.2
Downgrading all packaged from 5.2.2 to 5.2.1 works for me.
👍 ng build -prod --aot=false
Date: 2018-01-26T08:50:42.558Z
Hash: 6489d7e4ce1f1f08b377
Time: 33050ms
chunk {scripts} scripts.fd1b8544486b343d90d6.bundle.js (scripts) 539 kB [initial] [rendered]
chunk {0} polyfills.f20484b2fa4642e0dca8.bundle.js (polyfills) 59.4 kB [initial] [rendered]
chunk {1} main.5152e16c74af191dad78.bundle.js (main) 345 kB [initial] [rendered]
chunk {2} styles.7b9f938cde1e9541b6d2.bundle.css (styles) 448 kB [initial] [rendered]
chunk {3} vendor.571cdc5ee4a4893e9dcd.bundle.js (vendor) 1.27 MB [initial] [rendered]
chunk {4} inline.e544213acdf44988a8f0.bundle.js (inline) 1.45 kB [entry] [rendered]
👎 ng build -prod
Date: 2018-01-26T08:51:18.480Z • Hash: 8e2201377496e9821044 • Time: 28052ms
1 unchanged chunks
chunk {scripts} scripts.fd1b8544486b343d90d6.bundle.js (scripts) 539 kB [initial] [rendered]
chunk {0} polyfills.f20484b2fa4642e0dca8.bundle.js (polyfills) 59.1 kB [initial] [rendered]
chunk {2} styles.7b9f938cde1e9541b6d2.bundle.css (styles) 448 kB [initial] [rendered]
chunk {3} inline.e92868292339cf6d2e4f.bundle.js (inline) 1.45 kB [entry] [rendered]
ERROR in chunk main [initial]
[name].[chunkhash:20].bundle.js
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
tested with ngCli v1.6.6/v1.6.5 and angular v5.2.1
I'm having this issue as well.
TypeError: Cannot read property 'range' of null
I tested with: Angular 5.2.2 and 5.2.1 Angular CLI 1.6.6
Enabling vendor-chunk solve the issue temporarly
ng build --prod --aot --vendor-chunk=true
Tested with: Angular CLI: 1.6.7 Angular: 5.2.3 Node: 9.3.0
@akhedrane Here is an open issue regarding this: https://github.com/angular/angular/issues/21809 They are working on a solution.
As a note, if you switch to module: 'commonjs' instead of module: 'es2015' in your tsconfig.app.json, it will also fix this as a temporary workaround until https://github.com/angular/angular/pull/20624 (which simply changes locale modules to commonjs) is in.
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.