Angular Build Error: TypeError: Cannot read the 'line' property from undefined

I unexpectedly encounter an assembly failure error for production. I execute this command:

ng build --prod 

and get the following error:

 D:\a\1\s\node_modules\clean-css\lib\reader\input-source-map- tracker.js:37 if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) { ^ TypeError: Cannot read property 'line' of undefined at originalPositionFor (D:\a\1\s\node_modules\clean-css\lib\reader\input-source-map-tracker.js:37:23) at originalMetadata (D:\a\1\s\node_modules\clean-css\lib\tokenizer\tokenize.js:486:43) at intoTokens (D:\a\1\s\node_modules\clean-css\lib\tokenizer\tokenize.js:435:68) at tokenize (D:\a\1\s\node_modules\clean-css\lib\tokenizer\tokenize.js:74:10) at fromStyles (D:\a\1\s\node_modules\clean-css\lib\reader\read-sources.js:147:12) at fromString (D:\a\1\s\node_modules\clean-css\lib\reader\read-sources.js:48:10) at doReadSources (D:\a\1\s\node_modules\clean-css\lib\reader\read-sources.js:33:12) at readSources (D:\a\1\s\node_modules\clean-css\lib\reader\read-sources.js:24:10) at D:\a\1\s\node_modules\clean-css\lib\clean.js:99:12 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) Error: C:\Program Files\Git\bin\bash.exe failed with return code: 1 

It used to work fine a few days ago, but it suddenly stopped working. Any body has an idea why this is happening.

(I am using angular cli version 1.6.7)

Thanks in advance

+2
angular angular-cli
source share
3 answers

Good! He confirmed that this is happening in the latest version of angular cli.

Finally, I fixed my problem by downgrading to 1.6.7 and uninstalling ^ I ran into this problem even after downgrading:

"@ angular / cli": "^ 1.6.7"

Then I removed ^ to fix the cli version, and now it works fine.

I request an angular command that fixes this angular cli problem so that we can use the latest versions.

Hope this helps.

0
source share

While it seems that clean-css fails fantastically after @ angular / cli 1.6.7, this problem can be solved for later versions of @ angular / cli, independently.

It turned out to me that this problem is caused by inextricable spaces: https://github.com/jakubpawlowicz/clean-css/issues/1006

Then I was able to solve the problem by opening the src / folder as a workspace in Notepad ++, filtering to * .scss and * .css and doing a search using Regex using \xA0 to find incomplete spaces in scss / css files; I found him. After removal, my error disappeared.

0
source share

The problem is resolved.

ng build --env = prod solves the problem no need to downgrade angular cli

-one
source share

All Articles