javascriptnode.jsgulpgulp-clean-css

Cannot read property 'line' of undefined at originalPosition in gulp-clean-css plugin


As mentioned in the question, when I launch gulp build I get the following error:

C:\dev\work\viewAngular\web\node_modules\gulp-clean-css\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 originalPosition 
    For (C:\dev\work\viewAngular\web\node_modules\gulp-clean-css\node_modules\clean-css\lib\reader\input-source-map-tracker.js:37:23)

I dont know where this is coming up from since I didn't make any changes to gulp-clean-css files or anything related.

I also launched multiple times: bower update, bower install, npm install.


Solution

  • I got the same problem. My issue was that I had a devDependencies like this:

     "devDependencies": {
        ...
        "gulp-clean-css": "^2.0.3",
        ...
     }
    

    This bumped gulp-clean-cssto version 2.4.0 which crashed my build. Removing the ^ forced the older version and made my build run again.

    Now it's time up upgrade my dependencies, but at least I know what was failing...