In to_uri, if there are not components, return "/".
diff --git a/js/tools/build/ndn-js-uncomp.js b/js/tools/build/ndn-js-uncomp.js
index 781fb39..55131cd 100644
--- a/js/tools/build/ndn-js-uncomp.js
+++ b/js/tools/build/ndn-js-uncomp.js
@@ -610,6 +610,9 @@
 
 // Return the escaped name string according to "CCNx URI Scheme".
 Name.prototype.to_uri = function() {	
+    if (this.components.length == 0)
+        return "/";
+    
 	var result = "";
 	
 	for(var i = 0; i < this.components.length; ++i)