Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Check the paths of node and ng to ensure availability
Browse files Browse the repository at this point in the history
* The script assumes ng has been installed and added to the user path.
  However, this is not always the case, resulting in 'ng command not found'
  errors when trying to run the beetle-studio image.

* Checks the existence of both node and ng and ensures that the latter is
  using the one installed by npm in beetle-studio's own node_modules
  directory.
  • Loading branch information
phantomjinx committed Apr 3, 2018
1 parent 060290a commit a51f744
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ngapp/start.sh
@@ -1,5 +1,15 @@
#!/bin/bash

# Check node is available
command -v node >/dev/null 2>&1 || { echo >&2 "Requires 'node' but it's not installed. Aborting."; exit 1; }

# Check ng is available - should be post 'npm install'
NG="node_modules/.bin/ng"
if [ ! -f ${NG} ]; then
echo "Error: cannot find 'ng' so nothing can be executed... exiting"
exit 1
fi

#################
#
# Show help and exit
Expand All @@ -26,7 +36,7 @@ done
shift "$(expr $OPTIND - 1)"

if [ "${DEV}" == "1" ]; then
ng serve --host 0.0.0.0 --port 8080 --disable-host-check
${NG} serve --host 0.0.0.0 --port 8080 --disable-host-check
else
ng build && node ./server.js
${NG} build && node ./server.js
fi

0 comments on commit a51f744

Please sign in to comment.