Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm get stuck when an extra install/postinstall script should also be installed #5706

Open
Murtatrxx opened this issue Nov 27, 2022 · 15 comments

Comments

@Murtatrxx
Copy link

Murtatrxx commented Nov 27, 2022

pnpm version: 7.17

Code to reproduce the issue: pnpm add/install any dependency that has a post install script

Expected behavior: should also run the postinsall scripts

Actual behavior: waited for more than 30 mins, but no good luck. It just shows the message

image
(it failed because i did CTRL C)

Additional information: please correct me if i'm doing something wrong, i'm new to pnpm

  • node -v prints: 18.2
  • Windows, macOS, or Linux?: win11
@Murtatrxx
Copy link
Author

Murtatrxx commented Jan 26, 2023

Probably related with #5909

@Murtatrxx Murtatrxx changed the title pnpm stucks when an extra install/postinstall script should also be runned pnpm get stuck when an extra install/postinstall script should also be runned Jan 26, 2023
@Murtatrxx Murtatrxx changed the title pnpm get stuck when an extra install/postinstall script should also be runned pnpm get stuck when an extra install/postinstall script should also be installed Jan 26, 2023
@zkochan
Copy link
Member

zkochan commented Jan 26, 2023

Do you use node-linker=hoisted?

@Murtatrxx
Copy link
Author

Yes, but it's same with/without it

@Murtatrxx
Copy link
Author

Can confirm this issues also happens with yarn, in yarn on it's getting stuck when linking dependencies, and when you try to start it strangely restarts the console

@zkochan
Copy link
Member

zkochan commented Feb 7, 2023

does it only happen with prisma? does it work if you run pnpm install --ignore-scripts?

@Murtatrxx
Copy link
Author

1, can confirm it happens with all dependencies that has install or postinstall script
2, will try soon probably will work but we want that scripts to be runned

@Murtatrxx
Copy link
Author

Murtatrxx commented Feb 10, 2023

Hmmmm, I think I found the solution. It does something to do with Windows Legacy Console mode. And I come up with that solution.

  1. WIN R (Run) then regedit -- Open registry editor
  2. Navigate to Computer/HKEY_CURRENT_USER/Console
  3. Double click the option "ForceV2" DWORD parameter then click edit.
  4. Swap the value data (0 to 1, 1 to 0)
  5. Restart PC

That fixed my solution.

@weyert
Copy link
Contributor

weyert commented Feb 10, 2023

Hmmmm, I think I found the solution. It does something to do with Windows Legacy Console mode. And I come up with that solution.

Fascinating, so you are disabling this mode?

@Murtatrxx
Copy link
Author

Yeah, looks like it. I don't see a single relation between this but...

@zkochan
Copy link
Member

zkochan commented Feb 16, 2023

We have a special command for detecting issues like this: pnpm doctor.

Do you think we could detect if legacy mode is on and print an error about it?

@bchilcott
Copy link

bchilcott commented Mar 12, 2023

I've just tried disabling legacy console mode, to no avail. Running pnpm install gets stuck on a postinstall step, and after Ctrl + C it shows that windows message. Running any package.json script just immediately shows the windows message too.

image

pnpm install completes with --ignore-scripts, but running any package.json script (dev, start, etc) still doesn't work.

@bchilcott
Copy link

Hmmmm, I think I found the solution. It does something to do with Windows Legacy Console mode. And I come up with that solution.

Aside from it not working for me, I don't think disabling this option is a viable solution, only a workaround. It seems to prevent Windows Terminal from becoming the default terminal application which obviously isn't great.

@Murtatrxx
Copy link
Author

🤷‍♂️

@ChristophWolfPCG
Copy link

still happening, using npm now, that works

@nicolasembleton
Copy link

nicolasembleton commented Sep 4, 2023

I have had this issue as well since 2 days and after some debugging (removing PNPM and node and reinstalling them globally) I managed to pass the package that was blocking, to find out a package-level error saying this:

{"time":1693816829686,"hostname":"n.local","pid":28272,"level":"debug","name":"pnpm:link","target":"[...]/node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream","link":"[...]/node_modules/.pnpm/keccak@3.0.3/node_modules/readable-stream"}
{"time":1693816830834,"hostname":"n.local","pid":28272,"level":"debug","name":"pnpm:fetching-progress","attempt":2,"packageId":"registry.npmjs.org/fix/0.0.3","size":22144,"status":"started"}
{"time":1693816831105,"hostname":"n.local","pid":28272,"level":"debug","name":"pnpm:request-retry","attempt":2,"error":{"code":"ERR_PNPM_TARBALL_EXTRACT","attempts":2,"resource":"https://registry.npmjs.org/fix/-/fix-0.0.3.tgz"},"maxRetries":2,"method":"GET","timeout":60000,"url":"https://registry.npmjs.org/fix/-/fix-0.0.3.tgz"}

The issue I am now seeing is similar to this one falconair/nodefix#43 and seems to be related to a malformed JSON file (it would seem that there's a comma too many here:

  "directories": {
    "handlers": "./handlers",
  },

This ultimately fails saying this:

{"time":1693816891477,"hostname":"n.local","pid":28272,"level":"debug","name":"pnpm:fetching-progress","attempt":3,"packageId":"registry.npmjs.org/fix/0.0.3","size":22144,"status":"started"}
{"time":1693816891490,"hostname":"n.local","pid":28272,"level":"warn","name":"pnpm:package-requester","message":"Fetching registry.npmjs.org/fix/0.0.3 failed!","prefix":"[redacted path]"}
{"time":1693816891491,"hostname":"n.local","pid":28272,"level":"error","name":"pnpm","code":"ERR_PNPM_TARBALL_EXTRACT","attempts":3,"resource":"https://registry.npmjs.org/fix/-/fix-0.0.3.tgz","name":"pnpm","err":{"name":"pnpm","message":"Failed to unpack the tarball from \"https://registry.npmjs.org/fix/-/fix-0.0.3.tgz\": SyntaxError: Expected double-quoted property name in JSON at position 237","code":"ERR_PNPM_TARBALL_EXTRACT","stack":"pnpm: Failed to unpack the tarball from \"https://registry.npmjs.org/fix/-/fix-0.0.3.tgz\": SyntaxError: Expected double-quoted property name in JSON at position 237\n    at Worker.<anonymous> ([...]/.cache/node/corepack/pnpm/8.7.1/dist/pnpm.cjs:81781:20)\n    at Object.onceWrapper (node:events:629:26)\n    at Worker.emit (node:events:514:28)\n    at MessagePort.<anonymous> (node:internal/worker:263:53)\n    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20)\n    at exports.emitMessage (node:internal/per_context/messageport:23:28)"}}

pnpm: v8.7.1
node: v20.5.1 (it seems I could not "see" the error before and I was using node v18.17.1)

EDIT: The 2nd time I launch the install command, it then blocks again on the previous successful package being readable-stream. So I think it matches the pattern seen here.
EDIT2: I realized we did not need the FIX package, maybe installed by mistake running npm install fix of sorts (seems like it's nodefix but anyways). Everything works fine now. Maybe some other people have a similar issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants