[openstreetmap/openstreetmap-website] Yarn install broken - INSTALL.md out of date? (Issue #3579)
Andy Allan
notifications at github.com
Wed Jan 4 18:14:26 UTC 2023
There's two different issues discussed here, and while they are related they are not the same. `bundle exec rails yarn:install` failing to find yarn on Ubuntu is not the same issue as `The engine "node" is incompatible with this module.` for osm-community-index. The first is to do with package naming on Ubuntu, the second is to do with passing flags to yarn.
The behaviour of `bundle exec rails yarn:install` [changed in Rails 7](https://github.com/rails/rails/pull/43641), to directly call `yarn` instead of `bin/yarn`.
This is important for two reasons, the first being that `bin/yarn` [detects whether to call `yarn` or `yarnpkg`](https://github.com/openstreetmap/openstreetmap-website/blob/52078b5d764b867c643728ed5839a2cfbd9c5a2c/bin/yarn#L6).
The second reason is that `bin/yarn` passes the `--ignore-engines` flag, and without that yarn will fail on osm-community-index or js-cookie, which [has an existing discussion](https://github.com/openstreetmap/openstreetmap-website/issues/3275).
It's interesting to investigate why this didn't break anything in CI (both tests and for Docker) or elsewhere, since it indicates inconsistencies between our installation instructions and what CI is actually doing.
* For the CI tests - It calls [`bundle exec rails yarn:install`](https://github.com/openstreetmap/openstreetmap-website/blob/52078b5d764b867c643728ed5839a2cfbd9c5a2c/.github/workflows/tests.yml#L57), so I would expect it to fail! However, the GithubCI version of Ubuntu [has newer versions of node](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#installed-software) installed, and presumably has a binary called `yarn` too. So although we are trying to test on "Ubuntu" it's more like "Github flavoured Ubuntu" rather than "actual Ubuntu" or "vagrant ubuntu/focal64 flavoured Ubuntu". Hence the discrepancies between CI and INSTALL.md.
* For the Docker tests, this is more straightforward. The Dockerfile contains an explicit [`yarnpkg --ignore-engines install`](https://github.com/openstreetmap/openstreetmap-website/blob/52078b5d764b867c643728ed5839a2cfbd9c5a2c/Dockerfile#L50), which still works (but is Ubuntu specific). I think that should be changed to line up with our installation instructions.
* For production, OSMF [used to have a shim](https://github.com/openstreetmap/chef/blob/4e4da59c36d7727b244fedda27e97b11ae1e9a9e/cookbooks/nodejs/templates/default/yarn.erb) so that `yarn` worked and `--ignore-engines` was always passed to yarn, but [are now using nodesource packages](https://github.com/openstreetmap/chef/commit/cfa0fe92774c9dfcf0a0085d7772319550066ed7) to get both a binary called `yarn` and a new enough version of node that there are no engine warnings.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3579#issuecomment-1371261751
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/3579/1371261751 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230104/8f50b57b/attachment.htm>
More information about the rails-dev
mailing list