forked from coolaj86/node-installer.sh
Add helpful error message if the destination directory is not writeable. Working, but not consistant with AJ's code style.
This commit is contained in:
parent
895dcd31f2
commit
39a0891c10
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue