Skip to content

Angular CLI v20 creates project without less dependency #30503

Closed
@jgosar

Description

@jgosar

Command

new

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.14

Description

I upgraded Angular CLI to v20.0.1 and then tried to create a new Angular v20 application using LESS stylesheets.

After the node modules were installed, I tried to launch the app using ng serve without doing any modifications to the code.

I got the error Unable to load the "less" stylesheet preprocessor. [plugin angular-less].

I was able to resolve the issue by adding this to the devDependencies in package.json:

    "less": "^4.2.0",

But this should have been added by the CLI already.

Minimal Reproduction

ng new angular-demo-app
✔ Do you want to create a 'zoneless' application without zone.js (Developer Preview)? Yes
✔ Which stylesheet format would you like to use? Less [ http://lesscss.org ]
✔ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? No
cd angular-demo-app
ng serve

Exception or Error

Application bundle generation failed. [1.277 seconds]

✘ [ERROR] Unable to load the "less" stylesheet preprocessor. [plugin angular-less]

    angular:styles/global:styles:1:8:
      1 │ @import 'src/styles.less';
        ╵         ~~~~~~~~~~~~~~~~~

  Ensure that the "less" Node.js package is installed within the project. If not present, installation via the project's package manager should resolve the error.

Your Environment

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

Angular CLI: 20.0.1
Node: 22.12.0
Package Manager: npm 10.9.0
OS: linux x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2000.1 (cli-only)
@angular-devkit/core         20.0.1 (cli-only)
@angular-devkit/schematics   20.0.1 (cli-only)
@schematics/angular          20.0.1 (cli-only)

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions