Skip to main content

Questions tagged [pnpm]

pnpm uses hard links and symlinks to save one version of a module only ever once on a disk. When using npm or Yarn for example, if you have 100 projects using the same version of lodash, you will have 100 copies of lodash on disk. With pnpm, lodash will be saved in a single place on the disk and a hard link will put it into the node_modules where it should be installed. As a result, you save space on your disk and you have a lot faster installations!

Filter by
Sorted by
Tagged with
74 votes
4 answers
52k views

Can I use npx with pnpm?

Can I use npx together with a pnpm install? It doesn't seem to work and pnpx fetches remote dependencies, it seems more like npm create. Is there a way to use npx with pnpm to execute local binaries ...
Matt Sanders's user avatar
  • 9,793
67 votes
3 answers
41k views

nodejs will not enable corepack: operation not permitted

I have installed nodejs and i am trying to enable corepack with corepack enable but it gives me this error on windows: Internal Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\...
Nadia Hansen's user avatar
52 votes
2 answers
27k views

pnpm equivalent command for npm ci

What is the equivalent command for npm ci in pnpm? According to the documentation for npm install: pnpm install is used to install all dependencies for a project. In a CI environment, installation ...
BuZZ-dEE's user avatar
  • 6,627
51 votes
5 answers
79k views

pnpm peer dependencies auto-install

How (or on which file) to set true to do auto install dependencies ? my terminal error: hint: If you want peer dependencies to be automatically installed, set the "auto-install-peers" ...
fedoraname1's user avatar
41 votes
3 answers
21k views

What is difference between pnpm create, pnpx, dlx?

The pnpm package manager offers three commands that are alternatives for npm's npx command. These are pnpm create, pnpx and pnpm dlx. All three seem to do the same thing. But what are the differences ...
Arctomachine's user avatar
35 votes
3 answers
44k views

How to specify "packageManager" in package.json

As per https://nodejs.org/dist/latest-v16.x/docs/api/all.html#all_packages_packagemanager We can specify package manager from the list of supported package managers. However, the VS code complains ...
Adarsh Madrecha's user avatar
32 votes
9 answers
53k views

How do you switch between pnpm versions?

I'm currently working on an application that uses pnpm 6 but I have pnpm 7 installed. I couldn't find any documentation that shows me how to install and switch between versions. Thank you!
Shey Umar's user avatar
  • 321
30 votes
5 answers
34k views

How to get pnpm store directory

Is there any way how to check directory/path of pnpm store? I know you can set it with npm config set store /path/to/.pnpm-store, but npm config get store in my case returns undefined, which I guess ...
mauron85's user avatar
  • 1,484
25 votes
1 answer
13k views

Can I delete package-lock.json when switching to pnpm?

I'm in the process of switching from npm to pnpm, which has a different set of features that I prefer. The former uses package-lock.json to lock exact packages versions, the latter pnpm-lock.yaml. ...
Sekhemty's user avatar
  • 1,432
24 votes
1 answer
20k views

How to add dependency to PNPM workspace?

I start using PNPM Workspaces, and I'm struggling in how to add dependencies to any specific workspace as I would do in yarn running: yarn workspace <workspace_name> add <package_to_add> ...
Arnautg's user avatar
  • 909
22 votes
1 answer
33k views

How to remove a package from pnpm store, or force re-download it?

I use pnpm to manage npm project, and I modified the content of an installed package by accident, say, I cleared the content of node_modules/jquery/dist/jquery.js. The problem is no matter how i ...
Freewind's user avatar
  • 197k
20 votes
5 answers
15k views

`pnpm install` Usage Error: This project is configured to use yarn

I am trying to migrate from yarn to pnpm. I ran pnpm install. It instantly failed and printed to the console: Usage Error: This project is configured to use yarn $ pnpm ... I tried removing (...
Ahmed Shaqanbi's user avatar
20 votes
0 answers
5k views

Typescript pnpm monorepo, path aliases conflicts between local dependencies during build

I have a PNPM with TurbeRepo monorepo, used this template. In this monorepo I have a NextJS app that uses a ui-shared package (local shared code, not actually an npm package). The ui-shared is made in ...
Nikola-Milovic's user avatar
20 votes
1 answer
3k views

PNPM linking with standalone NextJS build

I'm trying to create production Dockerfile using NextJS standalone mode and PNPM. In next.config.js i have output configuration: experimental: { outputStandalone: true, outputFileTracingRoot:...
Dooomel's user avatar
  • 586
17 votes
3 answers
20k views

what the different between `pnpm install` and `pnpm add`?

I am work on monorepo stuff, and found that some guys use pnpm install to install packages in workspace, but some other use pnpm add. in the pnpm docs, its seem like the same between add and install ...
Nauxscript's user avatar
17 votes
4 answers
25k views

How to pnpm and Next.js in multi-stage docker file?

The official Next.js Dockerfile example does not work if I switch npm to pnpm. How should I modify that Dockerfile so that it remains multi-stage, but also uses pnpm instead of npm?
Meglio's user avatar
  • 1,705
15 votes
3 answers
15k views

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

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 ...
Mohsen Saleh's user avatar
13 votes
1 answer
23k views

How to install pnpx

I installed pnpm on linux with curl -fsSL https://get.pnpm.io/install.sh | sh - as explained at https://pnpm.io/installation . With this I got just pnpm but no pnpx installed. How can I install pnpx? ...
citykid's user avatar
  • 10.6k
13 votes
2 answers
51k views

How to have `pnpm install` install everything exactly to the specs of the pnpm-lock file?

If you connect a Github project to a product like Cloudflare pages or Vercel, commits to the remote repo trigger new builds. These builds will run the appropriate install and build commands. I haven't ...
user1087973's user avatar
12 votes
2 answers
8k views

Can pnpm replace npm link // yarn link?

npm link and yarn link are both "not the best". I run into issues with them quite often. Now I have read about pnpm and its local storage. I wonder if pnpm can help me remedy my npm link ...
helt's user avatar
  • 5,107
12 votes
6 answers
5k views

Preventing npm commands in favor of pnpm

I would like to switch to using PNPM over NPM for the usual reasons. Unfortunately cut and paste, or muscle memory takes over sometimes and I will accidentally use NPM to install a package in a ...
cycle4passion's user avatar
12 votes
2 answers
10k views

How to migrate a project from npm to pnpm

We have built a project with a deep tree of dependencies with npm install and have a lot of issues under Microsoft Windows (secondary target). I have read about pnpm and it seems to be a solution for ...
Aubin's user avatar
  • 14.7k
11 votes
1 answer
6k views

pnpm in monorepo - how to run a command only in a specific package?

Let's say I want to install a package in a specific package in my monorepo, how do I do this from root? in npm, you can do this with something like this: npm install react --workspace=a I searched ...
Jonathan Lightbringer's user avatar
11 votes
1 answer
5k views

pnpm -- sync versions of dependencies

Let's say I have the following stricture for a Javascript monorepo -- module a package.json -- module b package.json package.json Module A and Module B both depend on lodash. With pnpm, is ...
Nick's user avatar
  • 6,052
11 votes
2 answers
3k views

How to control pnpm workspace build order

I'm working in a large pnpm monorepo (pnpm v7). The repository contains : multiple apps multiple shared dependencies tooling (shared compilation setup package) Every package (app or shared library) ...
Steve B's user avatar
  • 37.5k
11 votes
3 answers
7k views

pnpm workspace:* dependencies

I have serious trouble installing an partial pnpm monorepo inside a Docker Conatiner. The problem is that docker build fails at some devDependencieswhich should not even be installed. "...
Mathias Maerker's user avatar
10 votes
4 answers
26k views

How to change where pnpm installs the global packages?

Question is simple, I want to change where pnpm installs the global packages. I have a custom Node installation on Windows and would prefer to have everything under that directory, especially as that ...
user8977154's user avatar
9 votes
4 answers
11k views

How can I help pnpm find its global directory?

I've got a clean install of pnpm v8.8.0 on Windows 11. When I try to intall a global package I get: ERR_PNPM_NO_GLOBAL_BIN_DIR  Unable to find the global bin directory I've tried pnpm setup --force. ...
bbsimonbb's user avatar
  • 28.3k
9 votes
2 answers
4k views

How to change package manager used with Angular CLI (e.g. using pnpm instead of npm for `ng add`)?

Did not find much, yet for that topic, therefore using SO-question. For commands like e.g. ng add @angular/material I would like to use the package manager of choice pnpm.
quizmaster987's user avatar
9 votes
1 answer
5k views

Revert from pnpm to npm

I just realized I won't be able to use pnpm in a project, due to compatibility issues with other tools. Is there a way to cleanly switch back to npm, which is my default package manager? What would be ...
juzello's user avatar
  • 361
9 votes
1 answer
2k views

How to use Ionic CLI with pnpm

How is it possible to use pnpm or bun instead of npm with ionic cli? it has some good benefits rather than npm, Like smaller storage usage, Showing progress when some package is downloading and etc...
Mohammad Reza Mrg's user avatar
9 votes
4 answers
3k views

How to use PNPM with Google Cloud Build?

I'd like to migrate to PNPM, however, I can't find a way to use its lockfile on Google Cloud. My current cloudbuild config is the following: steps: - name: "gcr.io/google.com/cloudsdktool/cloud-...
András Geiszl's user avatar
9 votes
0 answers
3k views

Webpack alias not working when using pnpm workspaces

I'm getting an error when using pnpm workspaces because it can't resolve react-dom. I think that's because I have an alias to use @hot-loader/react-dom instead of react-dom. However, it worked when I ...
Gwater17's user avatar
  • 2,224
8 votes
2 answers
7k views

How to fix vscode warning module not installed when using pnpm

mkdir a-1 && cd a-1 pnpm init pnpm i eslint --save-dev code . I opened this project in vscode on windows 10 and vscode showed these warnings. Module '.pnpm' is extraneous Module '@eslint/...
Fidel Yiu's user avatar
8 votes
2 answers
8k views

PNPM Github actions flow

I just moved my project from npm and lerna to pnpm but now when using GitHub actions I get the following error "line 1: pnpm: command not found" can someone suggest how the .yml file should ...
Hamzah Hameed's user avatar
8 votes
3 answers
13k views

pnpm uses old version of node

I am using nvm and I got node v14 installed and running node -v confirms that, but when I try to install a package in my project that requires the v14 engine pnpm tells me that I am currently using ...
Harry Kruger's user avatar
8 votes
2 answers
6k views

Type checking issues with using pnpm and typescript together

As I understand from tutorial pnpm creates symlinked .registry.npmjs.org and other entries point under node_modules. My project is on typescript and I have @types for typings in node_modules. But this ...
Alex Filatov's user avatar
  • 2,322
8 votes
1 answer
1k views

Nuxt 3 SSR - No console logs of server API in dev environment

When you do a simple console log in server API side, it doesn't show up when you build it using pnpm run dev. But if you build it using pnpm run build and run the index.mjs, the console log will show ...
BLNK's user avatar
  • 154
8 votes
2 answers
1k views

Mismatching React types in pnpm monorepo

i'm trying to convert an inherited monorepo from yarn+lerna to pnpm workspaces i'm currently getting an error due to mismatching react versions, typescript isn't picking up on the @types/react version ...
Tom Sherman's user avatar
8 votes
2 answers
3k views

pnpm & vue & vite monorepo - resolve import of alias path inside a workspace package

I'm building a monorepo of UI applications using shared components and style using pnpm, typescript, vue, and vite. While trying to leverage pnpm's workspace ecosystem to ease the development ...
RonZ's user avatar
  • 803
7 votes
4 answers
8k views

pnpm install: ERR_PNPM_LINKING_FAILED ("operation not permitted, rename[...]")

I started on a completely fresh Windows (11) system, installed Node, pnpm and so on. When running pnpm install, I've got the following error: "ERR_PNPM_LINKING_FAILED Error: EPERM: oprtation not ...
Joram's user avatar
  • 281
7 votes
1 answer
5k views

How to pass arbitrary argument with pnpm

With npm, you can pass random arguments like this: npm run build --foo="bar" You can then access foo value this way: process.env.npm_config_foo Is it possible to do the same with pnpm?...
Dmitry's user avatar
  • 4,293
7 votes
1 answer
1k views

pnpm postinstall ngcc doesn't run as should

within our ci pipeline, I try to use pnpm instead of npm as a package manager, but the postinstall script used to compile ivy incompatible libraries does not run as expected. The console output shows ...
Andreas Teich's user avatar
7 votes
1 answer
2k views

Turborepo set order of execution for dev pipeline

I have following scenario: /apps /api /web /packages /shared api and web have a dependency on shared. They are both installed with workspace: * using pnpm. My turbo.json looks like this: {...
JC97's user avatar
  • 1,600
7 votes
0 answers
634 views

Run script from PNPM bin with env-file

I have an .env file: STH=1 In Node 20 I can do: node --env-file=.env -e "console.log(process.env.STH)" 1 Is there a way, I can incorporate this into running a script with "PNPM". ...
madflow's user avatar
  • 8,272
7 votes
1 answer
3k views

Resolving packages directly to Typescript source in monorepo package.json files

What is the best answer for configuring package.json within an npm monorepo, (e.g. the "main", "module" or "exports" field), so that packages referenced locally can ...
cefn's user avatar
  • 3,151
7 votes
0 answers
3k views

how to run watch script in pnpm workspace

If I have structure like this packages - alice - bar - foo package.json alice, bar, foo are three sub packages. bar is the dependency of alice. Every sub package has its own watch script ...
Lynch's user avatar
  • 91
7 votes
0 answers
3k views

When am I try to reuse PNPM store, I getting 'cross-device link not permitted' in Docker build on GitLab CI

I'm trying to reuse pnpm store with docker buildkit inline cache. It is working fine, when I'm doing local build but on gitlab ci it throw cross-device link not permitted error. Error ... #12 2.257  ...
xeon's user avatar
  • 71
6 votes
1 answer
10k views

`pnpm add` within a workspace does not add projects from workspace

I am working with a very simple monorepo with the following structure: .npmrc package.json pnpm-workspaces.yml packages/ package-1/ package-2/ When I cd into package-1, I am trying to add a ...
Ryan Wheale's user avatar
  • 27.6k
6 votes
2 answers
2k views

pnpm/action-setup self installer issue

I've been running pnpm/action-setup@v2 for awhile now, but I started getting this error. Running self-installer...  WARN  GET https://registry.npmjs.org/pnpm error (ERR_INVALID_THIS). Will retry in ...
jmcgrath207's user avatar
  • 1,813

1
2 3 4 5
11