On ubuntu 14.10 (3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux), when I do:
sudo npm search yeoman-generator
npm WARN Building the local index for the first time, please be patient
FATAL ERROR: CALL_AND_RETRY_2 Allocation failed - process out of memory
While not a solution, per say, I typically do my searches on http://npmjs.org
Even when it works, npm search is epically slow due to the size of the index. I would recommend avoiding it unless you have no available browser.
See the canonical NPM search doesn't work issue: https://github.com/npm/npm/issues/6016