Skip to content

The package "string_decoder" wasn't found on the file system #30879

@BramCentric

Description

@BramCentric

Command

test

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

19.2.15

Description

After upgrading from Angular 19 to 20, latest, ng build webproject is working but ng test webproject is giving an error
This was working in version 19.

Minimal Reproduction

This is a large project, so I cannot provide the full project.

Exception or Error

> ng test webproject

Application bundle generation failed. [5.599 seconds]

✘ [ERROR] Could not resolve "string_decoder"

    node_modules/sax/lib/sax.js:240:25:
      240 │         var SD = require('string_decoder').StringDecoder
          ╵                          ~~~~~~~~~~~~~~~~

  The package "string_decoder" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Your Environment

Angular CLI: 20.1.5
Node: 22.18.0
Package Manager: npm 8.19.3
OS: win32 x64

Angular: 20.1.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.5
@angular-devkit/core         20.1.5
@angular-devkit/schematics   20.1.5
@angular/build               20.1.5
@angular/cdk                 20.1.5
@angular/cli                 20.1.5
@angular/material            20.1.5
@schematics/angular          20.1.5
ng-packagr                   20.1.0
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions