-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Implement postinstall error handling in a more cross-platform way #582
Comments
Because it's more cross-platform than alternatives like node scripts/postinstall || true or node -e \"try { require('./scripts/postinstall') } catch (_) {}\" Sure it's not perfect, so feel free to propose better sollution for preventing possible errors on |
Alright, I see! Do you happen to remember if there were any specific error conditions that this solution was created to solve? The script seems so simple that one would think that it would only fail if the environment was restricted in a very specific way, like having |
Yeah, this broke a ton of my builds. I'm not sure I agree this is more "cross-platform". This change makes core-js just not work at all on one platform. |
@dmwyatt wdym? |
|
Feel free to propose a fix. |
I don't yet fully grasp the point of the recent change or the point of your postinstall script. However, I do know that this breaks the install for everyone using powershell. My first reaction is to just get rid of your current postinstall script. My second reaction is: it worked fine on powershell before the recent change, so revert that change. Is the income stream from developers who sit and read their npm logs that significant? The Powershell equivalent is something like I've used run-script-os for doing cross-platform scripts before, though I've never used it for Would you consider a PR that uses that package to solve this issue? |
It is absolutely not related with any income from developers who read logs, it’s just a matter of principle after #548.
Before which change?
Unfortunately, this will not work on many platforms.
I'd prefer code without dependencies if it's possible. |
The one that introduced the "||" operator. edit: This one: 39fad35#diff-e47fcc6cb7b1d1082b3a338e00423374 |
@zloirock just ran into this today. cypress doesn't run under npm scipt-shell cmd.exe so I set to powershell.exe, then core-js wouldn't install. looking at 39fad35#diff-e47fcc6cb7b1d1082b3a338e00423374 changing the post-install hook to |
@dopry IIRC that causes issues in other platforms. Need to dig out where. |
It shouldn't cause issues on any posix compatible platforms and plays nice with powershell and cmd on windows... What other platforms were having an issue? I noticed you changed it from || true to || echo " |
Here was a reason why I replaced it, maybe you can find it in one of the related issues in the tracker. Maybe someone used |
It was a long time ago, I don't remember the source of this issue. Ok, we could try to add it and take a look at what will happen. |
Could you check it with the current version? |
@zloirock PS C:\test> npm i [email protected]
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library! The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -) npm notice created a lockfile as package-lock.json. You should commit this file.
PS C:\test> npm i [email protected]
At line:1 char:18
The token '||' is not a valid statement separator in this version. |
Currently the postinstall script eats errors with a
|| echo 'ignore'
construct. This does not work in PowerShell, and therefore the package is not installable by anybody foolish or brash enough to configure their npmscript-shell
to be PowerShell. Surely the postinstall script itself could be made to ignore any typical errors by itself? Can somebody shed some light on why it even has thatecho
at the end?I realize this may be a bit niche but it'd still be a nice little enhancement not to have to rely on specific shell features that are not universal.
The text was updated successfully, but these errors were encountered: