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 v7] crashes "add --global" with "ERROR Unable to find the global bin directory" #4658
Comments
Hello I also began seeing this issue with pnpm v7. Using this with fnm we can manually set josef ~
> fnm use 16
Using Node v16.14.2
josef ~
> npm bin -g
/Users/josef/.fnm/node-versions/v16.14.2/installation/bin
(not in PATH env variable)
josef ~
> pnpm -v
6.32.11
josef ~
> pnpm bin -g
/Users/josef/Library/Caches/fnm_multishells/96870_1651591328965/bin
josef ~
> pnpm add -g pnpm
Nothing to stop. No server is running for the store at /Users/josef/.pnpm-store/v3
Packages: +1 -1
+-
Progress: resolved 27, reused 26, downloaded 1, added 1, done
/Users/josef/.fnm/node-versions/v16.14.2/installation/pnpm-global/5:
- pnpm 6.32.11
+ pnpm 7.0.0
josef ~
> pnpm bin -g
ERROR Unable to find the global bin directory
Run "pnpm setup" to create it automatically, or set the global-bin-dir setting, or the PNPM_HOME env variable. The global bin directory should be in the PATH. |
This works as expected. If you use the standalone script to install pnpm, then it will add PNPM_HOME dir to your PATH. Otherwise, you may run We had to remove "autodetection" of global bin location because it was causing more trouble than good. |
Hi @zkochan Maybe it needs to update the installation guide? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Unfortunately, this has caused me a big headache with our Azure DevOps CI builds. Trying to fix using
This obviously is pretty painful and will need to be done for every script that is doing a global install as part of the pipeline. @zkochan you mentioned above that the automatic detection of the global store needed to be removed, what problems was it causing before? Is there a better workaround that I could use? |
This is not related to this issue. This is about missing or incorrect peer dependencies. You need to install |
@caveman-dick why do you need global packages?
There were many problems. Dozens of issues with dozens of messages. Some of the issues were that pnpm did not have write access to the global directory. Some issues were that pnpm was writing to a directory that the users didn't want to write to. Some issues were about pnpm overriding bins written by other package managers. In general, I would recommend not using global packages in CI. Your dependencies should be declared as dev dependencies of the project. |
@zkochan we use the unfortunately possibly due to the mismatch that the package is called Ideally, we would like to use the same package manager for all tasks to save confusion and hence why we have historically done a global install of the package. It also obviously saves having to prefix every subsequent cdk command as we run several as part of the pipeline. |
@zkochan, I honestly can't understand the logic behind this implementation of the global bin dir. By default, the global bin directory is set to a subdirectory of the current user. How can that make sense? Other users won't be able to access or write to that directory, which on servers is a real problem. Is it your intention that each user has their own copy of the binaries? If I set the global bin dir to a shared directory, like /usr/local/share/pnpm, pnpm absolutely refuses to find it. PNPM_HOME is definitely set and in PATH. Any suggestions? |
fwiw running export PATH="/Users/joeldenning/pnpm:$PATH"
export PNPM_HOME="/Users/joeldenning/pnpm" |
This is how most other tools work (volta, nvm, etc). This is how users suggested to do it If you think it should work differently, let's discuss it in a separate discussion.
This looks like a bug. Was there any output? |
I also find that (C:\Users\micro\AppData\Local\pnpm exists and is accessible and C:\Users\micro\AppData\Local\pnpm\store is populated from previous installs)
// new teminal
However, a restart seems to have fixed it:
|
Looks like |
Maybe this should improve it: #4701 |
I my case, pnpm's global bin directory changed and it has created C:\Users\arjit\AppData\Local\pnpm\global\5 The problem is pnpm changed global bin path so all modules just ignored like a fresh install. |
I use the brew to install
Hope this can help you! |
Why were you removing PNPM_HOME from |
A boring log of what happened to me, for information only.
|
This comment was marked as resolved.
This comment was marked as resolved.
"Open a new terminal to start using pnpm" is work for me. |
I am getting the same error when running |
This comment was marked as resolved.
This comment was marked as resolved.
Thank you! |
@zkochan Hi 👋
node: Video demonstration (skip to 0:50):pnpm_error.mp4Hope it will help you 😃 UPD: pnpm And here's why (one of these variants):
Video demo of fix (changing type of env right after `pnpm setup`):pnpm_error_fix.mp4 |
I have the same problem |
I have same problem - "ERROR The configured global bin directory "C:\Users\User\AppData\Local\pnpm" is not in PATH" |
This solving problems with update.
|
This is done in v7.17.1 Also, there is a related issue here: #5696 |
I'm also stuck with this. I haven't messed up with any env vars or so - just installed pnpm using npm some months ago. No manual changes of anything. It's been working great! But today I've got the following message while installing a dependency to a new package: Ok, so I follow the advice and: Don't know if the fact that I'm using What's the easiest workarond for this? Setting the PNPM_HOME dir to what? How do I find that out? Or should I rather just reinstall pnpm using the standalone script instead of using npm ? |
dont know if its related or not. |
Since as admin u can run, looks like u need admin role to install globally with your pnpm, what may be not good, try to use the windows terminal with powershell or, run this directly: $PNPM_HOME="C:\Users\user\AppData\Local\pnpm" | pnpm add -g to try to set your PATH |
I have confirmed that 7.17.1 from a clean environment will get things properly configured. |
Prior to v7.17.1 setup created |
That's what I thought at first, but then I saw the %USERPROFILE% variable in %PATH% and thought it wasn't that simple. |
It is indeed not as a simple as alphabetical ordering, but the type of the value matters.
Notice
You may fix your
which will keep its current value but overwrite the type. I think this issue should be Closed now. It is fixed with 7.17.1's change. Rerunning setup won't fix things. So maybe it could be changed to patch the type. |
This thread has too many unrelated issues. I am going to close it. If there are unsolved issues, create dedicated new issues. Initially this issue was opened for CI envs. As a rule, it is not recommended to install packages globally in CI at all. |
@cjosue15 Also solved on windows 10. thx |
I encountered the same issue too. After I |
Same issue here on Windows 10 with it telling me the path is not in PATH. Updating to v8.6.8 Running the update command in a terminal outside VSCode gave me a clue what was happening. Not sure why it didn't tell me in VSCode but since I installed pnpm via Then reopen terminal inside or outside VSCode and it works. I don't know why regular pnpm commands worked if the path was wrong. pnpm add worked in VSCode but pnpm list -g or pnpm i -g pnpm gave the error. |
@chioio thank you |
For some folks, simply opening a new terminal in vscode won't fix the issue after running |
If you installed it with |
add --global
does not work without additional configurationpnpm version: 7.0.0
Code to reproduce the issue:
Expected behavior:
pnpm add --global <module>
works correctly without additional configurationsActual behavior:
It causes an error and needs a workaround on CI
Additional information:
The text was updated successfully, but these errors were encountered: