How do I use pnpm in my Angular project to manage packages?

Viewed 4880

I am searching for a way to have one node_modules folder to use in my different projects. I found pnpm, installed it, and created one project with the commands:

ng new test-pnpm --skip-install

ng config cli.packageManager pnpm

pnpm install

ng serve

This project doesn't start. When I delete this project and .pnpm-stor folder, I cannot install packages for the next project with pnpm.

Can anyone tell me the steps to use it in a project, how to configure, how to install, how to add packages, and how to use it in different projects?

1 Answers

Don't remove the .pnpm-store folder. Only remove node_modules if you want to.

Try to run pnpm install --shamefully-hoist. If it helps, you can create a .npmrc file in the root of your project with shamefully-hoist=true.

The issue is that pnpm creates a strict node_modules and sometimes packages require other packages that are not declared in their package.json. See pnpm’s strictness helps to avoid silly bugs

Related