Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 15:59
    idkjs opened #2594
  • 15:56

    zkochan on stream

    feat: --stream Add new global … (compare)

  • 14:52
    zkochan milestoned #2147
  • 14:52
    zkochan milestoned #1609
  • 14:39
    zkochan labeled #2593
  • 14:05
    zkochan commented #2528
  • 13:44
    zkochan review_requested #2593
  • 13:32
    zkochan synchronize #2593
  • 13:32

    zkochan on 2528

    fix(run): infinite recursion A… (compare)

  • 13:29
    zkochan labeled #2593
  • 13:29
    zkochan opened #2593
  • 13:28

    zkochan on 2528

    fix(run): inifinite recursion … (compare)

  • 13:15
    zkochan milestoned #2528
  • 13:14
    zkochan assigned #2528
  • 11:29
    zkochan edited #2528
  • 11:28
    zkochan commented #2528
  • 11:26
    zkochan labeled #2528
  • 11:23
    zkochan labeled #2563
  • 07:51
    panoply commented #1609
  • May 29 23:40
    zkochan commented #2585
Pierrick Bignet
Thanks, I'm going to try this !
Pierrick Bignet
Thanks Zoltan, it works. I thought that enabling long paths would solve this kind of issues, but he ...
The only issue is that sharing the .npmrc between linux and windows developpers is not going to be easy.
Zoltan Kochan
@RDeluxe also, be aware that every lockfile needs its own virtual store dir. So two projects cannot have their virtula store dirs at the same location.
by default, the virtual store dir is at <project root>/node_modules/.pnpm
Chris Buckland
Hi all, I'm having some trouble with the dependencies filter: --filter package-name... In one repo the following command
pnpm --filter package-name... exec -- npm run env | grep package_name
correctly shows dependencies that are referenced by workspace: "dependency-name": "workspace:*". However I have another repo, which has the exact same pnpm configuration from what I can tell, and in that repo the same command only returns the specified package, and doesnt include the dependencies. Any ideas where my configuration might be wrong?
@zkochan running standard npm call on the directory would work too. Is it worth a feature request to support as such?
Ray Gesualdo
Does pnpm support restricting dependency versions? For instance, in a monorepo setup where each package uses react, can pnpm enforce that they are all on the same version? Further, can it fail if someone tries to update one of the packages to a newer version that hasn't been specified? I could have sworn I had seen this in the documentation somewhere, but now I can't find it.
Zoltan Kochan
@raygesualdo that is not possible at the moment but I think we could support that
4 replies
Zoltan Kochan
@panoply so pnpm install would call npm install?
@yahgwai I don't know what could cause that issue.
but if you can create steps to repro, please file an issue in our repo
Jonathan Morley
hey, i am seeing some unexpected behaviour with the --if-present flag of pnpm run -r. If I use it on a plain pnpm run call, it behaves as expected, in that it causes the command to still succeed if the script isnt present. pnpm run -r though seems to have some builtin checking for scripts, and will only execute the script on packages that contain the script (also expected). When no packages contain the script, pnpm run -r fails, with ot without --if-present. I would expect the --if-present flag to cause these calls to succeed
2 replies
Ryan Festag
@zkochan - Sorry, finally getting back to this. I am currently running pnpm run -r --workspace-concurrency 10 --filter ./apps --filter ./packages start, but only 2 processes ever start. Should I submit an issue for this? Or, if you have an idea of what the problem might be, I can see about submitting a PR
2 replies
Bar Yochai Bokovza ⁦🇮🇱⁩ 🏳‍🌈

I have a problem on my macOS machine (Sierra), and it happan across every Node.JS installation that exists (brew, regular, asdf, etc.)
Imagine that I'm doing these commands:

$ npx pnpm i -g pnpm # 1st command
$ npx pnpm link pnpm # 2nd command

Now, When I run the 1st command, it installs the pnpm into the folder /usr/local/Cellar/node/14.1.0/pnpm-global/3.
But when I run the 2nd command, It tries to find the pnpm bin in /usr/local/Cellar/node/14.1.0/pnpm-global directory.
I'm trying to find the place where can I change the installation folder, so that the 1st command and the 2nd command will route to the same folder.
I could do my own simple symlink, but it's manual and I need to handle it myself. What should I do in order to fix it?

5 replies
Pierrick Bignet

Hello, thanks for the info Zoltan. In the end I built the dependency and included the build in a fork. That's easier for now.

Wanted to ask about something else ; we are using pnpm heavily with monorepos (being pnpm workspaces or rushjs). In those, we have apps and tools or libs, and none are published to NPM.

Our typical CI/CD flow is :

  1. Install all deps and cache the folder (ie. caching with gitlab CI/CD) so it speeds up further installs
  2. lint, test, build (using the previously created cache)
  3. build docker images (simple COPY most of the time)
  4. deploy to K8S or other

Our problem is that for nodejs applications (express servers, SSR apps bundling an express server, etc.) we need the node_modules folder.
For now we have been copying the ENTIRE git folder, but of course that bundles all the dependencies of all our applications in each Docker File, not really optimum.

ie. for our api the Dockerfile looks like this

# Copy everything for now
COPY . .

# Remove useless packages
RUN rm -r packages/backoffice
RUN rm -r packages/studio
RUN rm -r packages/webapp
RUN rm -r packages/ui-kit
RUN rm -r packages/redux-store

WORKDIR /usr/src/app/packages/api

That's cumbersome, and error prone. Plus we pack too many dependencies and our images are getting huge.

I wanted to know if there was anyway to "unwrap" all dependencies are create "ready to use" node_modules folders (without symlinks if possible). I've been looking at package-import-method in COPY mode, thinking it might be the silver bullet, but I'm not quite sure yet.

Pierrick Bignet
I see several issues linked to this, like pnpm/pnpm#2198
Zoltan Kochan
yes, use that issue for discussion
I don't have an answer now
but why do you need the copy mode? Even if hard links are used, hard links are not symlinks
symlinks are created only inside node_modules
Pierrick Bignet
It was more a question, I thought it could be the silver bullet I needed
After some search, I found a useful plugin to adopt pnpm in Gatsbyjs projects. It must be useful for Pnpm and Gatsbyjs users.
Zoltan Kochan
In case someone wants to experiment with pnpm v5. Install it through pnpm i -g pnpm@alpha
Ryan Festag
I'm getting the following error when I run pnpm run start after installing v5 (with v4 this worked):
Error: No valid exports main found for '/home/ryan/.nvm/versions/node/v13.6.0/pnpm-global/3/node_modules/.pnpm/'
Matthew Pirocchi
Is there any typical scenario in which pnpm install on a fresh repo is much (~5-6x) slower than npm install? I have a package.json that takes about 30 seconds with npm and 2:30-3:00 with pnpm.
  "name": "temp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@types/fs-extra": "^8.1.0",
    "@types/glob": "^7.1.1",
    "@types/jest": "^25.2.1",
    "@types/node": "^13.13.5",
    "@types/tmp": "^0.2.0",
    "@types/yargs": "^15.0.4",
    "@types/yeoman-generator": "^3.1.4",
    "@types/yosay": "0.0.29",
    "@typescript-eslint/eslint-plugin": "^2.31.0",
    "@typescript-eslint/parser": "^2.31.0",
    "chalk": "^4.0.0",
    "copyfiles": "^2.2.0",
    "del": "^5.1.0",
    "eslint": "^6.8.0",
    "fs-extra": "^9.0.0",
    "glob": "^7.1.6",
    "jest": "^26.0.1",
    "jsonc-parser": "^2.2.1",
    "parcel-bundler": "^1.12.4",
    "parcel-plugin-shebang": "^1.2.8",
    "tmp": "^0.2.1",
    "ts-jest": "^25.5.0",
    "typescript": "^3.8.3",
    "yargs": "^15.3.1",
    "yeoman-assert": "^3.1.1",
    "yeoman-generator": "^4.10.0",
    "yeoman-test": "^2.6.0",
    "yosay": "^2.0.2"
Matthew Pirocchi
mpiroc@DESKTOP-QOHHTT1:~/repos/temp$ time pnpm i --reporter=ndjson > pnpm.log

real    1m4.691s
user    0m19.688s
sys     1m52.156s

mpiroc@DESKTOP-QOHHTT1:~/repos/temp$ git clean -dfx
mpiroc@DESKTOP-QOHHTT1:~/repos/temp$ time npm i --verbose > npm.log

real    0m39.453s
user    0m27.578s
sys     0m34.688s
8 replies
Ryan Festag
@zkochan: If we're having issues with v5, should we comment about it here or is it easier to open an issue? Pretty much anything I'm trying to do (either in an existing project or a new package) results in Error: No valid exports main found for '/home/ryan/.nvm/versions/node/v13.6.0/pnpm-global/3/node_modules/.pnpm/'
1 reply
Gillis Van Ginderachter
Hi all, I have a pnpm workspace project. One subproject, let's call it subproject-a in the workspace has a prepare script that runs cd lambda &&pnpm install && pnpm build. There's AWS Lambda code in the subproject-a/lambda folder that I'm compiling before publishing. In another subproject, let's call it subproject-b, I want to install subproject-a. So in subproject-b folder I run pnpm install. What happens now is that the prepare script of subproject-a runs, but it's trying to run pnpm install while pnpm install is already running for subproject-b! pnpm can't handle this and keeps waiting forever with this warning: WARN  waiting for another installation to complete... Any ideas anyone?
Ryan Festag
On the surface, it seems like lambda itself is its own project (since you run pnpm install in its directory)...why isn't it broken out into its own package directory (vs. being in sub directory of another project)? Presumably you wouldn't need a prepare phase in subproject-a, and you wouldn't have a nested pnpm install?
11 replies

@panoply so pnpm install would call npm install?

I mean, yeah. My use case might be rare but if I could traditionally install modules via npm that are able to work within a pnpm workspace it would be helpful, for example let's say I have several packages, eg:

  • dir1
  • dir2
  • dir3

dir1 and dir1 are using pnpm but dir3 would be using traditional npm. This would be helpful. Of course i can just cd and run npm on dir3 but I'd like to use pnpm exclusively, for everything because I'm a fanboy and really enjoy using this tool.

1 reply
Zoltan Kochan

I am working on a change that will allow linking packages to subdependencies.

I think this might be useful in monorepos. So in a workspace, even subdependencies will be linked from the repository. But I am hesitant to make it the default. So probably it will be on a setting. Maybe link-workspace-packages will accept somethink like true | false | deep

Sean Keenan
Hi all! I just wanted to say that I've been throughly impressed with pnpm. I spent over 3 days bashing my head against the wall trying to work past obscure npm and yarn bugs, only to find pnpm which solved everything I needed on top of a few things I didn't even know I wanted!
1 reply
Pnpm is broken down into a lot of great little packages. I'm using the @pnpm/filter-workspace-packages to create a custom script which tells me all the changes of each package while providing additional information about react-native "native" only changes. I was curious if pnpm considers these packages as internal and my not adhere strongly to semver or if it's fine to use as a public api.
1 reply
Is there a reason that pnpm does not respect .npmignore or files[] (within package.json) when linking workspace packages? – I'd like to leverage bundledDependencies[] on a linked workspace tarball which does not get published to any registry. It's rather frustrating because as of now, pnpm workspace: does not accept tarball and will include the entire contents of a package when linking within a workspace, so this results in bundledDependencies[] including the entire package when running pnpm pack – The only other solution is to link a tarball but in this case, running pnpm pack is going to result in a dependency using link:../ or file:..
1 reply
@zkochan can you expose a hook on the pack process in the pnpm file? which would allow us to hook into the pack runtime? this will allow us to apply edits to the package.json that its included in packed tarball.

I'm trying to use pnpm to solve the "node_modules problem", that is, to have light node_modules directories that just link to some common storage. After pnpm i in two different projects node_modules directories are 100+ MB and 50+ MB, respectively. Apparently, other than symlinks, there are two node_modules/.pnpm/ directories, also with a lot of duplicate files. Is there a setting to fix this or the problem isn't really solved? says

the virtual store cannot be shared between several projects. Every project should have its own virtual store.

3 replies
Rajasegar Chandran

How do I debug node after using pnpm install?
I am getting the following error if I try to debug:

node --inspect-brk ./node_modules/.bin/qunit tests/atam-test.js


basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
Waiting for the debugger to disconnect...
5 replies
Kongthap Thammachat
This message was deleted
2 replies
Zoltan Kochan

So many people ask why we have files in node_modules/.pnpm.

Everyone expects symlinks directly from the store.

I don't know how to explain that those are hard links. So the files are not copies.

maybe there should be some message after a fresh installation
like "node_modules/.pnpm created with hard links to the store"
@zkochan hi, what steps should i do when i want to rename the project folder or move the project to other path on the disk? it seems like loosing the link between the old project's path to the store, please guide
10 replies
Zoltan Kochan
pnpm v5.0.0-rc.2 is most probably ready and will be bumped to 5.0.0 in a week.
So please try to use it

Hi! How to cache PNPM on Github Action? I've tried to cache it here:

It doesn't seem to work. I got 0 MiB of cache stored and PNPM still download dependencies instead of using the cache.

2 replies
Been using v5.0.0 issue free on a pretty large project which has roughly 50+ packages. No errors thus far.
The speed gains. I can't. I just can't. So fucking good. Zoltan, you're an absolute gift to us all.
1 reply
Fernando Montoya

Does pnpm monorepo feature supports this use case?
I am currently using Lerna and my use case is for React.lazy, it only supports default exports, so you can't do:

const LazyLoadedComponent = import("@package-b/core/component")

You have to do:

const LazyLoadedComponent = import("@package-b/dist/core/component")

Which is no that clean and common as when using npm registry packages.

1 reply
Jonas De Kegel
Hi, we're running pnpm as part of a rushjs stack. To optimize our production deployment, we wanted to prune out devDependencies instead of reinstalling everything; which seems to work fine... with 1 caveat: it's removing our internal (part-of-monorepo) packages too, even if they're production dependencies.
Any advice?
2 replies
Pekka Hyvönen
Hello. Is hooks.afterAllResolved(lockfile, context): lockfile the way to go to remove duplicates from pnpm-lock.yaml ? Already using function readPackage (pkg) {...} to pin correct packages but it seems that some updates will cause duplicates to lockfile
8 replies
Zoltan Kochan
@/all pnpm v5 is now latest