Fix permission in the install_dir to that npm can install

This commit is contained in:
Antoine Lima 2024-03-10 22:54:59 +01:00
parent d180592b9d
commit 23546d9cd2
No known key found for this signature in database
GPG key ID: 5D1E65E3DEB73410
2 changed files with 7 additions and 0 deletions

View file

@ -149,6 +149,11 @@ ynh_setup_my_nodeapp() {
ynh_add_config --template="nginx-nodejs.conf" --destination="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_systemd_action --service_name=nginx --action=reload
# Subsequent npm install will write to this folder (as it is within $app's home)
# As such we prepare it with fitting rights
mkdir -p "$install_dir/.npm"
chown $app:$app "$install_dir/.npm"
}
ynh_remove_my_nodeapp() {

View file

@ -90,6 +90,8 @@ then
ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs.service"
ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs-watcher.service"
ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs-watcher.path"
mkdir -p "$install_dir"/.npm
chown -R $app:$app "$install_dir"/.npm
fi
#=================================================