The problem is with the connection.
First, find out the IP address of the system:
$ ifconfig
Then replace localhosts in query.js with IP that you found with the previous command
Example:
@@ -12,7 +12,7 @@ var options = {
user_id: 'PeerAdmin',
channel_id: 'mychannel',
chaincode_id: 'fabcar',
network_url: 'grpc://<IP address>:7051',
};