pnpm: `pnpm i` get stuck forever on `postinstall` script
pnpm version: 7.24.2
Code to reproduce the issue:
pnpm install
Expected behavior:
All packages successfully installed
Actual behavior:
Get stuck in one of the postinstall
scripts from a package
Additional information:
node -v
prints: v16.19.0- Windows, macOS, or Linux?: macOS
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 12
- Comments: 66 (25 by maintainers)
Commits related to this issue
- fix: out of memory exception with node-linker=hoisted ref #5909 — committed to pnpm/pnpm by zkochan a year ago
- fix: out of memory exception with node-linker=hoisted (#5988) ref #5909 — committed to pnpm/pnpm by zkochan a year ago
- fix(deps): update symlink-dir ref #5909 — committed to pnpm/pnpm by zkochan a year ago
Facing the same issue pnpm@8.1.1
@mgcrea thanks, I have released that fix in v7.26.3
I tested v7.26.3 and it’s working 🎉
It looks like it works if
prefer-symlinked-executables
is set tofalse
, or this line is commented out:https://github.com/pnpm/pnpm/blob/5bede17edb5359daf6078bf69d488069b1b2ceba/pkg-manager/link-bins/src/index.ts#L214
Here’s a small repo that reproduces the problem https://github.com/chungweileong94/pnpm-hang-up-bug
Two key things in this repo:
node-linker=hoisted
postinstall
same issue here, If i remove the “node-linker=hoisted” setting there seems to be no issues
@zkochan This issue seems to be back in v7.27.0, reverting back to v7.26.3 fixes it.
Here is the output I’m seeing when it fails trying to install a dependency, this is using turborepo and
node-linker=hoisted
->@zkochan Can confirm that this branch fixes it while I still got the error using
v7.26.1
🎉Hello, I just tested with
v7.26.1
and the issue is still there:We have debugged it a bit with @kickbk
These are some of the findings so far:
package-import-method=copy
is set in.npmrc
(or you runpnpm install --package-import-method=copy
https://github.com/pnpm/pnpm/blob/98d6603f317a9ab28a2181aabbf63dd0f98d3804/pkg-manager/headless/src/linkHoistedModules.ts#L136-L140
It got stuck when linking bins to
node_modules/react-native/node_modules/.bin
Furthermore, downgrading to
7.18.2
seems to fix the issue. Using7.19.0
results inWARN An error occurred while uploading
for various packages (the same as https://github.com/pnpm/pnpm/issues/5823) and using7.24.0
gets rid of the warning but then results in the hang that this issue is related to.I specifically remember I was facing issue #5823 before, then it was fixed by #5902, however, it started to have this issue.
I also experience this issue now with prisma. Keep in mind that it’s not happening on first install. This starts happening with the second install.
Not sure if this is related to https://github.com/pnpm/pnpm/issues/5823. If you remove
node_modules
, then runpnpm i
, it will run perfectly fine. But it will get stuck in subsequencepnpm i