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
{{ message }}
Repository navigation
npm RFC #868 will block this package's install script by default #213
I'm reaching out because unrs-resolver is one of the most depended-on npm packages that runs an install script, and an accepted npm RFC is going to change how those scripts behave.
The RFC blocks dependency install scripts by default during npm install. That's the same thing pnpm, Yarn Berry, Bun, and Deno already do. Users opt back in per package through a new allowScripts field in package.json (or the npm approve-scripts command). The motivation is the run of supply-chain attacks over the last couple of years that used postinstall hooks to run code the moment a package landed in the tree.
For unrs-resolver, the script that's affected is:
"postinstall": "node postinstall.js"
That script downloads or builds something unrs-resolver needs to work, so under the new default it won't run unless the user adds unrs-resolver to their allowScripts. Installs that skip it will likely fail at runtime with a missing-binary error, which is a confusing failure mode for your users. The most robust fix is to move that work to first use, the first time the package is actually run, so it keeps working with no allowlist entry. If it has to stay at install time, please document the allowScripts line prominently in your README.
I wanted to flag this early so you've got time to plan rather than find out when the install warnings start showing up. The full RFC is here: npm/rfcs#868. Happy to answer any questions.
@JounQin
This is impacting me as the post install is now not running by default. We have omit=optional and since this script is no longer running as of 1.12.2 we are forced to look for options to force this to work?
This is a setting i inherited, ther eis discussion around if it should stay so i can't answer your question.
Should unrs-resolver be impacted by this already? As of 1.12.2 it seems like the postinstall isn't running. is that intended? It looks like the RFC isn't merged, so is that a bug or did something change?
That's unexpected, could you prepare a reproduction?
MacBook Pro
Apple M2 -> Tahoe 26.5
just updated from 1.11.1 -> 1.12.2
on node 22.13.0 with omit=optional.
(oddly it does appear that node 24 works, but i haven't nailed down exactly when this fixes, so don't hold me to this yet)
When i npm i/npm ci on my branch with this version of unrs-resolver i receive
Error: ● Validation Error:
Preset jest-preset-angular not found relative to rootDir
from jest
we tracked this down to the requisite @uns resolver missing, we are able to fix this by manually running the postinstall in our postinstall, but that's obviously a hack, unideal.
This does seem to be working on our Linux box just fine?
will update if anything we find changes findings
EDIT
if i update to Node 24.16.0, clear my node_modules and npm i everything seems happy. i don't really know what this means at the moment
@JounQin
Alright, i guess the primary concern is that we didn't change our node version, all we did was change our unrs-resolver version and things changed/regressed. I feel like something had to have changed on your end to have caused that?
@kstrasters-pj Again, a reproduction is required if you think it's a regression on our side, otherwise I can't do anything. We set the postinstall script correctly as you can see, you can manually run it successfully, so I don't think that's controlled by us.
inside the Shell area, navigating to workspace/sandbox and running nvm use 22 or nvm use 24 depending on which thing you want to rest, then closing the terminal with the "X" to get a new terminal on the node version.
remove the node_modules, npm i omit=optional and see that you don't get anything inside the @unrs directory on 22, but do on 24
I'm slightly confused as to the exact meaning of this. I'm assuming you don't think any changes are necessary.
The suggestion from the reporter was:
The most robust fix is to move that work to first use, the first time the package is actually run, so it keeps working with no allowlist entry. If it has to stay at install time, please document the allowScripts line prominently in your README.
Please could one of these actions be undertaken to either avoid the errors, or document why it isn't being changed, and the consequences of not allowing it?
Reacted by Tatu Aalto, Jordan Harband and Nathan McWilliams
Because npm 12 is out and post install scripts are blocked by default, fixing the install script would be nice, there is documentation how the migration can be done in https://installsafe.dev/. If fixing is not possible, for any reason, it would be good to document why it is not and what it affects.
IIUC the point of the install script is to work around bugs like npm/cli#4828 that were (hopefully completely) resolved in later releases of npm v11. If so, it's fine for npm v12 to ignore it.
In particular, the script ensures that the matching platform-specific optional dependency (native binding) is properly linked/activated.
resolved in later releases of npm v11. If so, it's fine for npm v12 to ignore it.
So in seems in this case a note could be added to the README, indicating how people can know if they need to do npm deny-scripts or nom approve-scripts based on the criteria?
I can submit a PR following a similar format, but I need a bit more explanation about 1) how can the user determine if they need the script, and 2) what is the alternative option if a user wants to run it manually, instead of allowscript.
After investigation, I decide to move postinstall script to runtime fallback check instead, the fallback logic is actually already there: napi-postinstall/fallback for WASI (WebContainer), see also un-ts/napi-postinstall#75, it'll be adopted into unrs-resolver soon later.
Activity
JounQin commentedon Jun 2, 2026
Thanks, that's fine for this package.
kstrasters-pj commentedon Jun 3, 2026
@JounQin
This is impacting me as the post install is now not running by default. We have
omit=optionaland since this script is no longer running as of 1.12.2 we are forced to look for options to force this to work?JounQin commentedon Jun 3, 2026
@kstrasters-pj Why you prefer
postinstalloveroptionalDependenciesby the way.For
yarn, there isenableScripts: true.For the new
npm, there will benpm approve-scripts.For
pnpm, there ispnpm approve-builds unrs-resolver.kstrasters-pj commentedon Jun 3, 2026
@JounQin
This is a setting i inherited, ther eis discussion around if it should stay so i can't answer your question.
Should unrs-resolver be impacted by this already? As of 1.12.2 it seems like the postinstall isn't running. is that intended? It looks like the RFC isn't merged, so is that a bug or did something change?
JounQin commentedon Jun 3, 2026
That's unexpected, could you prepare a reproduction?
kstrasters-pj commentedon Jun 3, 2026
MacBook Pro
Apple M2 -> Tahoe 26.5
just updated from 1.11.1 -> 1.12.2
on node 22.13.0 with omit=optional.
(oddly it does appear that node 24 works, but i haven't nailed down exactly when this fixes, so don't hold me to this yet)
When i
npm i/npm cion my branch with this version of unrs-resolver i receivefrom jest
we tracked this down to the requisite
@unsresolver missing, we are able to fix this by manually running the postinstall in our postinstall, but that's obviously a hack, unideal.This does seem to be working on our Linux box just fine?
will update if anything we find changes findings
EDIT
if i update to Node 24.16.0, clear my node_modules and
npm ieverything seems happy. i don't really know what this means at the momentJounQin commentedon Jun 3, 2026
It seems a npm bug but hard to be reproduced, I don't think it can be fixed on our side without a GitHub repo reproduction.
kstrasters-pj commentedon Jun 3, 2026
85217e3#diff-fff9f6b30324b6ed7184ec2ac9e0d1eb007dc997e9465a9cb1105b7f478c305aR542
We were looking at some commits and found that 1.12.2 doesn't have the (same) fallback env trigger? Is it possible that could be contributing?
JounQin commentedon Jun 4, 2026
@kstrasters-pj That commit is unrelated.
https://app.unpkg.com/[email protected]/files/package.json#L27
https://app.unpkg.com/[email protected]/files/postinstall.js
kstrasters-pj commentedon Jun 4, 2026
@JounQin
Alright, i guess the primary concern is that we didn't change our node version, all we did was change our unrs-resolver version and things changed/regressed. I feel like something had to have changed on your end to have caused that?
22.13.0 was working fine on 1.11.1
JounQin commentedon Jun 4, 2026
@kstrasters-pj Again, a reproduction is required if you think it's a regression on our side, otherwise I can't do anything. We set the
postinstallscript correctly as you can see, you can manually run it successfully, so I don't think that's controlled by us.kstrasters-pj commentedon Jun 4, 2026
@JounQin I don't know if this will work, i'm not familiar with this app at all really, but i was able to reproduce it here
https://replit.com/join/gmwlskaitz-kstrasters
inside the
Shellarea, navigating toworkspace/sandboxand runningnvm use 22ornvm use 24depending on which thing you want to rest, then closing the terminal with the "X" to get a new terminal on the node version.remove the node_modules,
npm i omit=optionaland see that you don't get anything inside the@unrsdirectory on 22, but do on 24Standard8 commentedon Jun 27, 2026
I'm slightly confused as to the exact meaning of this. I'm assuming you don't think any changes are necessary.
The suggestion from the reporter was:
Please could one of these actions be undertaken to either avoid the errors, or document why it isn't being changed, and the consequences of not allowing it?
aaltat commentedon Jul 13, 2026
Because npm 12 is out and post install scripts are blocked by default, fixing the install script would be nice, there is documentation how the migration can be done in https://installsafe.dev/. If fixing is not possible, for any reason, it would be good to document why it is not and what it affects.
ehoogeveen-medweb commentedon Jul 13, 2026
IIUC the point of the install script is to work around bugs like npm/cli#4828 that were (hopefully completely) resolved in later releases of npm v11. If so, it's fine for npm v12 to ignore it.
In particular, the script ensures that the matching platform-specific optional dependency (native binding) is properly linked/activated.
Allow [email protected] install script (#664)
Allow [email protected] install script (#896)
mysticflute commentedon Sep 16, 2026
So in seems in this case a note could be added to the README, indicating how people can know if they need to do
npm deny-scriptsornom approve-scriptsbased on the criteria?JounQin commentedon Sep 16, 2026
@mysticflute Indeed, would you like to raise a PR for it?
mysticflute commentedon Sep 16, 2026
@JounQin I would be happy to, though I need more context about when the script is needed to run or can be skipped.
I found a few examples of how other packages are documenting it:
I can submit a PR following a similar format, but I need a bit more explanation about 1) how can the user determine if they need the script, and 2) what is the alternative option if a user wants to run it manually, instead of allowscript.
JounQin commentedon Sep 17, 2026
node_modulesand fresh install, or install with the wasm package@unrs/resolver-binding-wasm32-wasiinsteadJounQin commentedon Oct 20, 2026
After investigation, I decide to move
postinstallscript to runtime fallback check instead, the fallback logic is actually already there:napi-postinstall/fallbackfor WASI (WebContainer), see also un-ts/napi-postinstall#75, it'll be adopted intounrs-resolversoon later.feat: resolve native bindings at runtime instead of postinstall