'Angular StackBlitz error: [NoSuchMethodError: method not found: 'write$1' on null]

I am trying to setup a Stackblitz project with Angular Material theming, following the official guide for Angular Material 11 theming.

I created a sass file for the custom theme configuration theming.scss, but when I try to import it into the global styles.scss file I get the following error in StackBlitz:

Error in src/styles.scss
NoSuchMethodError: method not found: 'write$1' on null

The project doesn't run, you can test it from the link above, can you tell me what is wrong my configuration? Thank you.



Solution 1:[1]

The problem

Today I opened an old project that I'm sure worked fine. I got the same error.

That's how I found this question ?...

I think the problem is the builder under the hood.

I think it doesn't use versions of Angular and Sass matching your package.json.

The solution

The way to bypass entirely the issue is using a webcontainer version (the recent Node.js project) of stackblitz. That way it compiles using your real dependencies. Here's a blitz you can fork

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sampgun