production icon indicating copy to clipboard operation
production copied to clipboard

Stop if JQ is not installed

Open amenk opened this issue 3 years ago • 9 comments

Running the build without JQ will only lead to more problems, so it is better to fail early

amenk avatar Nov 30 '21 14:11 amenk

What problems do you experience exactly? Is it all related to the npm dependencies of plugins not being installed because of the missing jq?

keulinho avatar Dec 01 '21 07:12 keulinho

Yes exactly. We have a plugins.json but the build failed because (we believe) the npm install did not run for the plugins:

ERROR in /web/vendor/store.shopware.com/swagpaypal/src/Resources/app/storefront/src/swag-paypal.abstract-buttons.js
Module not found: Error: Can't resolve '@paypal/paypal-js' in '/web/vendor/store.shopware.com/swagpaypal/src/Resources/app/storefront/src'

So I think it is better to enforce the presence of jq to avoid harder-to-debug errors afterwards.

What do you think?

amenk avatar Dec 01 '21 07:12 amenk

I think that depends, as long as you don't have plugins that need additional npm dependenies you don't need jq, but in order to be able to detect if there are plugins with npm dependencies jq needs to be installed.

keulinho avatar Dec 01 '21 08:12 keulinho

Okay, so maybe we should at least improve the warning. Anyways, I am a fan of things failing early, so I still would say it's fine to just require "jq".

amenk avatar Dec 01 '21 08:12 amenk

We could also add a SKIP_DEPENDENCY_CHECK flag one could set who is sure that there are no dependencies which would skip the whole jq part. Still a fan of fail-early and avoiding hard-to-debug issues :-)

amenk avatar Oct 18 '22 15:10 amenk

I agree, this can be really time consuming and frustrating (for beginners) - I think a flag should be enough.

@keulinho what is your fear in adding the exit? Hosters that don't provide the extension or users that get stuck there?

Isengo1989 avatar Nov 18 '22 11:11 Isengo1989

I guess we should do that change for 6.5 somewhere at https://github.com/shopware/recipes/blob/main/shopware/storefront/6.4/bin/build-storefront.sh ?

Shall we go head with a SKIP_DEPENDENCY_CHECK flag?

amenk avatar Apr 20 '23 07:04 amenk

I also spent a good amount of time figuring out that issue... That would be really really great to have it merged to the project. At least developers will quickly find out that there is a dependency required, instead of just silently erroring out.

By the way, jq is not highly used on servers out there.

matheusgontijo avatar Apr 20 '23 11:04 matheusgontijo

It would be nice to have these added to the list of requirements. We also had the issue with our hoster, and needed to convince them to install it. So if that went into the system requirements or recommendations, this could be a place to tell them or check by ourselves.

ChristianOellers avatar Oct 11 '23 09:10 ChristianOellers