First off, update your R package—the current version is 4.1.2. It's a good practice not to lag further behind than the current 4.x; it's usually no problem to be at 4.x.2, say, when the current is 4.x.9, but 3.x is clear out.
In particular, the {arules} package requires that R be at version 4.0.0 or greater. After you've replaced R just
install.packages(arules)
in the console pane