Skip to content

bug(Angular 14): Error on build loading (SassError + Module Not found) #25959

@lmsantanam

Description

@lmsantanam

Is this a regression?

  • No

The previous version in which this bug was not present was

No response

Description

I'm trying to setup a new work environment in a client remote server (Windows server 2019) for them to be able to build a new site whenever changes are uploaded to the git repository. As a clarification, this project does build perfectly on my computer and the computer of another programmer

I did the following on that machine:

  • I made sure no previous version of node/npm was installed before, validate this folders
    image

  • Installed the same version of NodeJS I have locally (16.5.0) including the additional components option in the nodejs installing option (python, chocolatey)

  • Installed the same version of Angular cli I have locally (14.1.1)

  • npm i runs well, no vulnerabilities detected
    image

  • When I do ng build, it fails. See the messages I see:

    • It starts with warnings about "Invalid dependencies have been reported by plugins or loaders for this module". It shows for basically all ts files that import something:
      image

    • Then some warnings about not using comments with "//" and to please use "/* ... */" (is that important?)

    • Then I get the breaking errors:

      • "SassError: Can't find stylesheet to import." followed by "module not found"
        image
        image

      • Just after that, errors about not recognizing stuff like "describe" or "beforeEach" in test files
        image

      • And finally a message about all scss files "didn't return a string."
        image

Important files

tsconfig.app.json
image

angular.json (this is where I tried a couple of things with the "stylePreprocessorOptions > includePaths" but no luck so far)
image
image

I really have no idea how to solve this after looking for a solution for the last couple of days. All the solutions I could find are related to either using an older version of angular than me or using an older version of angular material. This is a new project that was created on angular 14 and was working fine

I do suspect it might be related to something in Windows Server since is the only difference I can think of. Appreciate any help/suggestions

NOTE: To compile on the server is a requirement by the client, we don't have the people/time/resources to build something to deploy via CI/CD and/or docker, and honestly, is crazy we can't do a simply ng build

Reproduction

I have no idea how to reproduce this problem in another machine

Expected Behavior

Create a build

Actual Behavior

Build fails with import errors related to scss files/angular material/other files

Environment

  • Angular: 14
  • CDK/Material: 14.1.1
  • Browser(s): N/A
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows server 2019

ng version info:

Angular CLI: 14.1.1
Node: 16.15.0
Package Manager: npm 8.5.5
OS: win32 x64

Angular: 14.1.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1401.1
@angular-devkit/build-angular   14.1.1
@angular-devkit/core            14.1.1
@angular-devkit/schematics      14.1.1
@angular/flex-layout            14.0.0-beta.41
@schematics/angular             14.1.1
rxjs                            7.5.7
typescript                      4.7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions