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!
pnpm
504
questions
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 ...
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\...
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 ...
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" ...
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 ...
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 ...
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!
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 ...
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.
...
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>
...
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 ...
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 (...
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 ...
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:...
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 ...
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?
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 ...
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?
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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) ...
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.
"...
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 ...
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. ...
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.
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 ...
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...
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-...
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 ...
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/...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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?...
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 ...
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:
{...
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". ...
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 ...
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 ...
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 ...
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 ...
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 ...