fenneclab / hugo-bin

Binary wrapper for Hugo
MIT License
93 stars 26 forks source link

buildTags in package.json doesn't work in npm v7 #109

Closed gabrielmaldi closed 3 years ago

gabrielmaldi commented 4 years ago

"hugo-bin": { "buildTags": "extended" } in package.json doesn't work in npm 7.0.3 (node v15.0.1, macOS), the normal (not extended) version of Hugo is downloaded.

Using a .npmrc file with hugo_bin_build_tags = "extended" does work correctly (the extended version of Hugo is downloaded).

Thanks!

XhmikosR commented 4 years ago

Confirmed in Bootstrap where I made a test branch with Node.js 15. Not sure if it's an npm regression, though. You could try making an upstream issue.

XhmikosR commented 4 years ago

BTW any fixes to the tests are welcome; I don't think currently this is caught.

XhmikosR commented 4 years ago

I looked into it a bit more and I have to say I don't get why this happens.

https://github.com/fenneclab/hugo-bin/blob/520ea02bdac2cfccd1967855c7d03557dc98ec2b/lib/index.js#L70

This returns extended when set even with Node.js 15.0.1/npm 7.0.3:

process.env.HUGO_BIN_BUILD_TAGS: undefined
process.env.npm_config_hugo_bin_build_tags: undefined
config: {"buildTags":"extended"}
config.buildTags: extended
hugoBin.buildTags: extended

Also, it seems tests do fail: https://travis-ci.org/github/fenneclab/hugo-bin/jobs/739991022

I'm unsure how to debug this further. I think making an issue in the npm repo might be the best approach.

XhmikosR commented 3 years ago

There was a bug in npm 7.x that led to npm ci ignoring postinstall scripts. That was fixed in npm 7.3.0. I tested the latest Node.js/npm and everything seems to work fine here: https://github.com/twbs/bootstrap/runs/1610654261

I assume that was the same issue you were having, if not let me know.

gabrielmaldi commented 3 years ago

Just tested my setup in npm 7.3.0 and this is indeed fixed. Thanks!