diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index f85d571..dc2dac2 --- a/install.sh +++ b/install.sh @@ -289,9 +289,23 @@ if [ -z "${NODE_PATH-}" ]; then # /usr/local/bin/node => /usr/local node_install_path="$(dirname $(dirname $(type -p node)))" echo "NODE_PATH is not set. Using existing node install path: '$node_install_path'" + if ! echo "test" > $node_install_path/.test + then + echo "Node install path is not writable. Run: NODE_PATH=$HOME/.local/opt/node/lib/node_modules" + if [ -f "$node_install_path"/.test ]; then + rm "$node_install_path"/.test + fi + fi else node_install_path=$PREFIX/usr/local echo "NODE_PATH is not set. Using default install path '$node_install_path'" + if ! echo "test" > $node_install_path/.test + then + echo "Node install path is not writable. Run: NODE_PATH=$HOME/.local/opt/node/lib/node_modules" + if [ -f "$node_install_path"/.test ]; then + rm "$node_install_path"/.test + fi + fi fi else node_install_path=$(dirname $(dirname $NODE_PATH)) @@ -383,4 +397,4 @@ if [ "--dev-deps" == "$deps_flag" ]; then echo "" fi -rm -rf "$my_tmp" \ No newline at end of file +rm -rf "$my_tmp"