Skip to content

ng-add forces use of NPM to install dependencies even when another package manager is configured in angular.json #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FabienDehopre opened this issue Jan 10, 2025 · 2 comments · Fixed by #515

Comments

@FabienDehopre
Copy link
Contributor

When you install the package using ng add @testing-library/angular and you have configured another package manager than NPM, the install phase fails.

Capture d’écran 2025-01-10 à 10 04 11

In the code of the ng-add schematics, the packageManager has a default value set to "npm".

export function installDependencies(packageManager = 'npm') {

I think if you don't pass the packagerManager option, the NodePackageInstallTask task should use the package manager configured in the angular.json file, right?

@FabienDehopre FabienDehopre changed the title ng-add forcely use NPM to install the dependencies even when another package manager is configured in angular.json ng-add forces use of NPM to install dependencies even when another package manager is configured in angular.json Jan 10, 2025
@timdeschryver
Copy link
Member

Oops, my bad... I can't remember why it's like that.
It can be replaced with:

context.addTask(new NodePackageInstallTask());

Do you want to create a PR for this @FabienDehopre ?

@FabienDehopre
Copy link
Contributor Author

Sure! I'll do it this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants