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 not being executed for pngquant-bin on MacOS #2853

Open
llamerr opened this issue Mar 11, 2021 · 7 comments
Open

postinstall not being executed for pngquant-bin on MacOS #2853

llamerr opened this issue Mar 11, 2021 · 7 comments
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@llamerr
Copy link

llamerr commented Mar 11, 2021

Current Behavior:

One of subdependencies is pngquant-bin which have postinstall script which is not being executed now

Expected Behavior:

postinstall should execute and generate node_modules/pngquant-bin/vendor/pngquant file

Steps To Reproduce:

Do npm ci for this package.json file
https://github.com/llamerr/npm-postinstall-bug
and check content of ls node_modules/pngquant-bin/vendor/
as of now, it only contains source folder, but pngquant file is missing

No errors or warnings reported by npm during install from what I see, https://github.com/llamerr/npm-postinstall-bug/blob/master/install.log

It probably started happening after yesterday's upgrade on MacOS. First after I did rm -rf node_modules and npm ci everything broke, so I checked updates and noticed new, upgraded my MacOS, brew, and command line tools. After everything started working again, I still was getting errors in my code which lead me to pngquant bin being missing. I'm using node from nvm if it matters, not sure if I did global packages update (I think I did? At least for some of them, will re-try now), but seems other stuff working fine.

Environment:

OS: MacOS Big Sur 11.2.3 (20D91)

➜ npm-postinstall-bug git:(master) node -v
v14.15.3

➜ npm-postinstall-bug git:(master) npm -v
7.6.2

➜ npm-postinstall-bug git:(master) pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

package-id: com.apple.pkg.CLTools_Executables
version: 12.4.0.0.1.1610135815
volume: /
location: /
install-time: 1615403944
groups: com.apple.FindSystemFiles.pkg-group

@llamerr llamerr added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 11, 2021
@llamerr llamerr changed the title [BUG] <title> Mar 11, 2021
@llamerr
Copy link
Author

llamerr commented Mar 11, 2021

I removed package-lock.json and did npm i --force again (some packages are incompatible, but seem to work fine) and it did postinstall properly this time. Should I close it or is it still a bug?

@burtonator
Copy link

@llamerr why should this bug be removed ? I'm having the same issue. on Linux (our CI system) and MacOS.

postinstall just doesn't seem to be reliably executed in v7. I'm noticing this across dozens of projects including eslint and electron.

@llamerr
Copy link
Author

llamerr commented Mar 28, 2021

@burtonator I was thinking the issue was that I used force install, so maybe there were some incompatibilities, but that's still strange since I did not see any errors or warnings if I recall correctly.

@burtonator
Copy link

@llamerr I'm seeing this happen with other packages regardless of ci or install and regardless of package-lock.json or none.

This is happening with electron, eslint, etc. Completely breaking our workflow.

v6 has some serious bugs that we had to avoid so now we're on v7 but there are bugs on v7 we have to avoid too.

@darcyclarke
Copy link
Contributor

@llamerr can you try replicating this problem on the latest version of npm? (ie. npm i -g npm) We had a bug at one point in an earlier v7 where package-lock.json was missing some context which could have effected executing lifecycle scripts.

@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label May 7, 2021
@llamerr
Copy link
Author

llamerr commented May 7, 2021

I tried to reproduce it before upgrading, my current versions are:

➜  npm-postinstall-bug git:(master) node -v
v14.16.0
➜  npm-postinstall-bug git:(master) npm -v
6.14.11

and it seems on those versions it's already not reproducing, means working fine

hm... actually I did not remove node_modules before trying it, but checking log, it seems that was done by npm

➜  npm-postinstall-bug git:(master) npm ci
npm WARN prepare removing existing node_modules/ before installation

after npm update (can nvm be related?)

➜  npm-postinstall-bug git:(master) npm i -g npm
/Users/alexey.lukin/.nvm/versions/node/v14.16.0/bin/npm -> /Users/alexey.lukin/.nvm/versions/node/v14.16.0/lib/node_modules/npm/bin/npm-cli.js
/Users/alexey.lukin/.nvm/versions/node/v14.16.0/bin/npx -> /Users/alexey.lukin/.nvm/versions/node/v14.16.0/lib/node_modules/npm/bin/npx-cli.js
+ npm@7.12.0
added 60 packages from 23 contributors, removed 241 packages and updated 194 packages in 6.705s

versions now are

➜  npm-postinstall-bug git:(master) node -v
v14.16.0
➜  npm-postinstall-bug git:(master) npm -v
7.12.0

and now bug is reproduced:

➜  npm-postinstall-bug git:(master) ls node_modules/pngquant-bin/vendor/
source

actually I see that on first try today it was 6.14.11, probably I downgraded it during this time somehow, not sure

@MrTibbles
Copy link

I too am having issues with the postinstall script of a sub-dependency not being called. However when ran with yarn it works as expected.

I have package A that has package B listed as a dependency, package B has a post install hook defined. When package B is installed directly by a project the post install script fires as expected, however when package A is installed the post install script for package B is not being called. I have passed --foreground-scripts to ensure nothing is being missed.

I was initially encountering this on npm v8, so i updated to v9, but i am still facing the exact same issue.

Node version: v18.14.2
npm version: 9.5.0
OS: Mac Ventura 13.0.1 (22A400)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
4 participants