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
When only-allow is set in a package as a preinstall script, it prevents other packages from installing the given package using an alternate package manager.
For example: if in a package foo with package.json:
then not only can I not do npm install in foo (well if I disregard the bugs in npm v7 which seems to run install before preinstall), I seem to be unable to do in a package barnpm install foo.
Running only allow as a prepare script is also not suitable because:
only-allow will unnecessarily be run during publish, and
npm install git://path/to/foo.git inside bar will be stopped.
only-allow should only restrict package managers when running npm install in the package itself!
The text was updated successfully, but these errors were encountered:
It turns out that npm install has a very unintuitive behavior. According to the folks at npm in an issue I filed with them:
preinstall is a script that runs before the install script, not before the install action. This was discussed in a PR where we proposed changing it, but realized it would be a breaking change: #2713
With this the case, I am not sure how only-allow functionality can even be made to work, no matter which script you use? Any advice (even not a fix) is appreciated.
As discussed over at discord.
When
only-allow
is set in a package as apreinstall
script, it prevents other packages from installing the given package using an alternate package manager.For example: if in a package foo with
package.json
:then not only can I not do
npm install
in foo (well if I disregard the bugs in npm v7 which seems to run install before preinstall), I seem to be unable to do in a package barnpm install foo
.Running
only allow
as aprepare
script is also not suitable because:only-allow
will unnecessarily be run during publish, andnpm install git://path/to/foo.git
inside bar will be stopped.only-allow
should only restrict package managers when runningnpm install
in the package itself!The text was updated successfully, but these errors were encountered: