You have set the accessor with the value method, but not the actual data for the pie layout.
.data(d3.layout.pie().value(function(d) { return d.vals; })(nodes))
Keep in mind that the pie layout is a function returning a function. The previous line could be rewritten like this:
var pie = d3.layout.pie();
// pie is a functions with attributes, i.e., a value accessor
pie.value(function(d) { return d.vals; });
// and here we set the values
var pieData = pie(nodes)
...
.data(pieData)
Your code is still not totally working with this fix, but one problem at a time ;)