From 350282617d2b4af74e54217ea4e414631dda84c1 Mon Sep 17 00:00:00 2001 From: Edouard Vincent Date: Tue, 30 Aug 2022 21:27:42 +0000 Subject: [PATCH] fix: only require unsafe-perm when installing as root --- ci/build/npm-postinstall.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build/npm-postinstall.sh b/ci/build/npm-postinstall.sh index 7d5e13b02910..31e22344fe9a 100755 --- a/ci/build/npm-postinstall.sh +++ b/ci/build/npm-postinstall.sh @@ -92,8 +92,8 @@ main() { case "${npm_config_user_agent-}" in npm*) # We are running under npm. - if [ "${npm_config_unsafe_perm-}" != "true" ]; then - echo "Please pass --unsafe-perm to npm to install code-server" + if [ "$(whoami)" = "root" ] && [ "${npm_config_unsafe_perm-}" != "true" ]; then + echo "Please pass --unsafe-perm to npm to install code-server as root" echo "Otherwise the postinstall script does not have permissions to run" echo "See https://docs.npmjs.com/misc/config#unsafe-perm" echo "See https://stackoverflow.com/questions/49084929/npm-sudo-global-installation-unsafe-perm"