PowerShell snapins not found when using node.js child_process.spawn()

I am trying to call a PowerShell script from node.js. The ps script works fine, but fails to find SQL snapins when I run it from a node.js child process.

Here is the node.js script:

"use strict";

var spawn = require('child_process').spawn;

var child = spawn('powershell.exe', ['.\\test.ps1']);
child.stdout.on("data", function (data) {
    console.log("Powershell Data: " + data);
});
child.stderr.on("data", function (data) {
    console.log("Powershell Errors: " + data);
});
child.on("exit", function () {
    console.log("Powershell Script finished");
});
child.stdin.end();

And here is the PowerShell script (test.ps1, this is a stripped down script to just show the error):

Add-PSSnapin SqlServerCmdletSnapin100

When I run test.ps1 from a cmd window or PS window, there are no errors. When I run the node.js code, I get:

Add-PSSnapin : The Windows PowerShell snap-in 'SqlServerCmdletSnapin100' 
is not installed on this machine.

What am I missing?

This was caused by using the 32-bit version of node.js. By installing the 64-bit version, the problem was resolved.