tools: Use package.json to identify which nodejs deps to install

Use package.json to identify which nodejs packages to install during autogen.sh.

I hope this will fix #1498 but want confirmation from the reporter first.