ILIAS
ILIAS copied to clipboard
Project assigned cache directory for composer and npm
On RHEL and binary compatible distributions, such as AlmaLinux9, problems can occur when using composer and npm when accessing the globally configured directory paths of the cache directories.
With a project-based and RHEL-compliant configuration for the cache directory of the respective application, such conflicts can be resolved very easily.
Cache directory
- the cache directory should be created outside the webroot
- the cache directory should be ignored by git, the directory name ".cache" is suitable for this purpose
- the cli user must have write access to the cache directory. For the command
sudo -u apache composer installthe cache directory should be assigned to the user / groupapacheand the access rights should be set to ```0700or0770``.
Composer
- here a simple entry in the composer.json in the config block is sufficient, for example directly at
vendor-dirin a new line"cache-dir" : "./.cache",
npm
- a file with the name
.npmrcmust be created in the public directory with the contentcache=./../.cache - here the access rights for the cli user and this group could be set with
0660,0640or ``0600```
Links
- https://getcomposer.org/doc/06-config.md#cache-dir
- https://docs.npmjs.com/cli/v8/commands/npm-cache
- https://docs.npmjs.com/cli/v8/configuring-npm/npmrc