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

postinstall hook doesn't appear to be run #721

Closed
wavded opened this issue Oct 11, 2016 · 10 comments
Closed

postinstall hook doesn't appear to be run #721

wavded opened this issue Oct 11, 2016 · 10 comments

Comments

@wavded
Copy link

wavded commented Oct 11, 2016

Do you want to request a feature or report a bug?

Not sure if its a feature or a bug, but I was expecting my postinstall hook to run after yarn was executed and it did not.

What is the current behavior?

yarn installs dependencies but does not run postinstall hook in the package.json file.

If the current behavior is a bug, please provide the steps to reproduce.

Sample package.json:

{
  "name": "hi",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "echo hi"
  },
  "dependencies": {
    "lodash": "*"
  },
  "main": "index.js",
  "license": "MIT"
}

Run yarn. Do not see hi echoed.

What is the expected behavior?

Node 6.7.0 and Yarn 0.15.1 and macOS 10.12

Please mention your node.js, yarn and operating system version.

@wavded
Copy link
Author

wavded commented Oct 11, 2016

I noticed this comment from TC that may shed some light?

By default, npm also allows developers who write these packages to execute other code that’s needed as part of the install process. That creates security issues, though, so Yarn does not have this feature.

-- Source

Perhaps postinstall was removed intentionally? It is handy when someone is setting up a project on their machine to have any additional setup stuff done at that point.

@Restuta
Copy link

Restuta commented Oct 12, 2016

It's handy in few other cases as well, e.g. on heroku it's a recommended way to customize build process https://devcenter.heroku.com/articles/nodejs-support#customizing-the-build-process

@rjmunro
Copy link
Contributor

rjmunro commented Oct 12, 2016

This is strange, because in my experience, I found that the postinstall script was run for a package I was installing, but it didn't work for some reason, which I have documented in #614.

@shiftkey
Copy link

@rjmunro I also see the postinstall hooks working fine for installed packages, but any postinstall command defined in my project.json are ignored.

@rjmunro
Copy link
Contributor

rjmunro commented Oct 13, 2016

@shiftkey That sounds exactly backwards if the intention is to prevent third party code running on install unnecessarily.

@glebmachine
Copy link

Looks the same issue here: #614

@sebmck
Copy link
Contributor

sebmck commented Oct 15, 2016

Fixed via #800.

@sebmck sebmck closed this as completed Oct 15, 2016
@henev
Copy link

henev commented Oct 17, 2016

Still reproducible with Angular 2 Quickstart tutorial as described here: #818

@karneaud
Copy link

Does post install work or not?

@vith
Copy link

vith commented Aug 15, 2018

@karneaud Looks like it's working but terminal output is hidden. Currently open issue is here: #5476

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

No branches or pull requests

10 participants