You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As reported in go-task/task#1081, local installation with npm v9 or later always installs binaries in the global directory.
This is because @go-task/go-npm always uses the environment variable npm_config_prefix to get the installation directory instead when the npm bin command fails.
In npm v9 and later, the npm bin command has been removed.
@go-task/go-npm should only use the npm_config_prefix environment variable when in global mode.
In the case of npm and pnpm, global mode can be detected by reading the npm_config_global environment variable.
Note
This needs to be released as a breaking change.
When @go-task/go-npm is upgraded, the user's environment will no longer remove binaries that were previously installed by mistake.
For example, the following version range is specified in @go-task/cli:
In this case, when @go-task/go-npm is updated to a version such as 0.1.19, the @go-task/cli dependency is implicitly updated. Since postuninstall is not run at this time, task binaries that were incorrectly installed by @go-task/go-npm before this bug was fixed will not be removed.
Therefore, it is necessary to upgrade to a version out of this range (e.g. 0.3.0, 1.0.0).
As reported in go-task/task#1081, local installation with npm v9 or later always installs binaries in the global directory.
This is because
@go-task/go-npm
always uses the environment variablenpm_config_prefix
to get the installation directory instead when thenpm bin
command fails.In npm v9 and later, the
npm bin
command has been removed.go-npm/src/common.js
Lines 25 to 49 in b3015da
@go-task/go-npm
should only use thenpm_config_prefix
environment variable when in global mode.In the case of npm and pnpm, global mode can be detected by reading the
npm_config_global
environment variable.However, in the case of Yarn V1, the
npm_config_global
environment variable does not exist, so thenpm_config_argv
environment variable should be parsed to determine this instead. I am still investigating the correct logic, but it is still buggy 1.Footnotes
Currently it compares the order of the
global
andadd
arguments in theoriginal
property. However, from reading the Yarn v1 source code, it should probably be enough to check that the value of thecooked
property is not["add"]
. But I haven't been able to test it with the old Yarn yet. ↩The text was updated successfully, but these errors were encountered: