Is Angular compatible with Yarn's zero installs?

Discussão em 'Angular' iniciado por AbVog, Dezembro 15, 2024.

  1. AbVog

    AbVog Guest

    I am running into an error after starting up a new project, which causes me to wonder whether I'm correctly reading the information I got online.

    Following instructions from Angular and other sources about using Yarn as the packkage manager, I ran these commands:

    npm install -g @angular/cli typescript less less-plugin-clean-css
    ng version
    ng config -g cli.packageManager yarn
    ng new my-app
    yarn add @angular/material @angular/cdk
    yarn install
    ng serve


    At this point, after confirming that the Angular version was indeed the one I wanted, I thought the app generated by the Angular CLI would simply run. However, I get this error message:


    Node packages may not be installed. Try installing with 'yarn install'. Error: Could not find the '@angular-devkit/build-angular:dev-server' builder's node package.
    ​

    Having already run the suggested command, I went back to the Yarn documentation to double check the meaning of the command.

    I am now wondering whether yarn's installation of the packages is compatible with what Angular expects. I am surprised to find very little information about this. Just about every search result speaks of installing packages with npm install. If so, I wonder what's the point of using yarn.

    I am clearly missing something to understand how Angular 19 is supposed to work with Yarn. The .angular-config.json file in my home directory has this:

    {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "cli": {
    "packageManager": "yarn",
    "analytics": false
    },
    "version": 1,
    "projects": {}
    }

    Continue reading...

Compartilhe esta Página