diff --git a/build.sh b/build.sh
index 139cf5c72db8f49ccfd776688aee39f88e72b3f0..fba421fa821ee00f0e102da19ee2a8a662e53f31 100755
--- a/build.sh
+++ b/build.sh
@@ -5,4 +5,8 @@ set -e
 TAG=${1:-latest}
 REGISTRY=${2:-theia}
 
-docker build --build-arg "version=$TAG" . -t "$REGISTRY:$TAG" --no-cache
\ No newline at end of file
+if test -f "$TAG.package.json"; then
+    docker build --build-arg "version=$TAG" . -t "$REGISTRY:$TAG" --no-cache
+else
+    echo "$TAG.package.json: file does not exist"
+fi
\ No newline at end of file