angular-cli: TypeError [Error]: Cannot read properties of undefined (reading 'column') at convertSourceSpan

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

15.2

Description

Compilation fails on SASS processing

Minimal Reproduction

node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve --host=0.0.0.0 --disable-host-check --port=4700

maybe there must be an error in SASS files

Exception or Error

| Generating browser application bundles (phase: building)...
node:internal/event_target:1010
                           ^
TypeError [Error]: Cannot read properties of undefined (reading 'column')
    at convertSourceSpan (F:\frontend\node_modules\@angular-devkit\build-angular\src\sass\worker.js:146:30)
    at MessagePort.<anonymous> (F:\frontend\node_modules\@angular-devkit\build-angular\src\sass\worker.js:111:27)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:290:10)
    at [kOnMessage] (node:internal/worker:301:37)
    at MessagePort.<anonymous> (node:internal/worker:202:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v18.14.0

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 16.0.0
Node: 18.14.0
Package Manager: npm 9.1.3
OS: win32 x64

Angular: 16.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.0
@angular-devkit/build-angular   16.0.0
@angular-devkit/core            16.0.0
@angular-devkit/schematics      16.0.0
@schematics/angular             16.0.0
rxjs                            7.8.1
typescript                      4.9.5

Anything else relevant?

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 20

Commits related to this issue

Most upvoted comments

My version is 16.1.3. This happens when you use “&” in .scss without a wrapping element.

Error &.some-class { ... }

Success .parent { &.some-class { ... } }

+1 here. I was working ok until appears this problem. I can’t compile 😦

imagen

I have the same error with Angular 16.2.0 with selector:

.some-class:has(.some-internal-selector){
   &-suffix{
   }
}

But if I remove & then all works

.some-class:has(.some-internal-selector){
   .some-class-suffix{
   }
}

It’s annoying

Any news about this bug? Nothing in the issue you created but maybe you got some info through different channel. And in the meantime are there any workaround for this bug? Such as downgrading sass version or another package.

I am hitting this bug right now after removing usage of @import and put @use instead.

To me, this happened when I tried to do: ‘@extend p.tiny’. Selector ‘p.tiny’ exists in another scss file. Tried other element - classname combinations. All led to this error.

Angular CLI: 16.1.3
Node: 16.20.0
Package Manager: npm 8.19.4
OS: darwin x64