fix: Fix using environment variables to specify prefix#8415
fix: Fix using environment variables to specify prefix#8415MarcellPerger1 wants to merge 2 commits intonpm:latestfrom
Conversation
|
This is a danger area and we should make sure we know if this was intentional before adding it. Setting the prefix before certain operations has caused bugs in the past. I don't know for sure that this is a problem, but caution is in order here. Setting the prefix in npm is tricky because by the time we're parsing it we have sometimes already assumed we know what the prefix is. |
|
I don't really understand why this could cause problems. We're already setting |
IMHO, this wasn't intentional and it was simply forgotten about when the environment variable configuration was added (as prefix is a bit of a special case). Could this be merged please? |
Previously, the code in
workspaces/config/lib/index.jsdidn't take into account the environment variables when determiningConfig.localPrefix.This means that commands using
localPrefixcould previously behave unexpectedly or fail (if the current working directory isn't part of a package) when the prefix is specified usingNPM_CONFIG_PREFIX=....This PR fixes this by simply checking the environment variables as well using the
Config.#get('prefix', 'env')References
Fixes #4467.