First, run a new isolated container:
docker run --rm -it ubuntu bash
Now, setup npm and try to install package:
apt-get update && apt-get install -y npm
npm install grunt
You might see some funky garbage in your terminal window. Sometimes, it will hang, so expect to kill your session out of band.
Any thoughts?
Sounds like you're running the ancient included-with-ubuntu npm 1.3, which is no longer supported.
Today we turned on gzip encoding for json responses. It however did not vary the cache correctly, so it used cached gzip data on requests that did not accept gzip, such as those issued by npm 1.3
The fix will be rolling out, but I strongly encourage you to use a current node and npm, perhaps from the deb.nodesource.com repo.