Skip to content
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

Post install script is harmful #77

Closed
crubier opened this issue Nov 17, 2020 · 1 comment · Fixed by #78
Closed

Post install script is harmful #77

crubier opened this issue Nov 17, 2020 · 1 comment · Fixed by #78

Comments

@crubier
Copy link
Contributor

crubier commented Nov 17, 2020

Since we installed this package, 50% of our CI/CD pipeline started failing.

The reason is that this package uses a post install script.

Here is the error which is thrown 50% of the time during yarn install:

# This file contains the result of Yarn building a package (react-virtual@virtual:02f6a86156759c9bb9f5bd96fa55ba1015b8993e779050fe9b358272baec2106973f2be4251a130e2a18a9511f3b6b721ac69018e06c8384da2a44074e767c50#npm:2.3.1)
# Script name: postinstall

UsageError: Couldn't find �[38;2;215;135;95mreact-virtual�[39m�[38;2;135;175;255m@�[39m�[38;2;135;175;255mnpm:2.3.1 [02f6a]�[39m in the currently installed PnP map - running an install might help
    at B.findPackageLocation (/Users/vincent/Code/sterblue3/.yarn/releases/yarn-2.3.3.cjs:2:251129)
    at F.A.A.openPromise (/Users/vincent/Code/sterblue3/.yarn/releases/yarn-2.3.3.cjs:2:401596)

This is caused by the post install script:

#!/usr/bin/env node

var msg = `
👩‍💻 Use react-virtual at work?
🎉 Consider sponsoring/supporting its development at:
  
  https://github.com/sponsors/tannerlinsley
`

console.log(msg)

Post install scripts should only be used in very specific cases, as explained here

opencollective/opencollective#1625

Also, there is now first class support for package support messages, to avoid this problem:

https://github.com/nodejs/package-maintenance/blob/main/docs/PACKAGE-SUPPORT.md

I will create a MR to remove the postinstall script

@crubier
Copy link
Contributor Author

crubier commented Nov 17, 2020

Related: https://blog.opencollective.com/beyond-post-install/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant