Hi Graham,
Both local-exec and command-line show these same errors:
command line output:
make: Entering directory '/opt/the_app/node_modules/karma/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory '/opt/the_app/node_modules/karma/node_modules/ws/build'
builderror.log:
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:194:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-1062-aws
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/the_app/node_modules/karma/node_modules/ws
gyp ERR! node -v v7.10.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
However, while terraform local-exec crashes at this point, a standard bash shell outside of terraform will continue and finish the rest of the "npm install", and exit without error, status 0. As mentioned above, it appears the node module is attempting to build native extensions. If those fail, it's supposed to continue, since they are an optimization rather than being a requirement. Overall, the real solution is to upgrade npm and node, etc. because they are quite out-of-date. The mystery is why terraform isn't identical to bash. Ok, checking the output of commands "shopt" and "set -o", the options appear to be slightly different. Could be a reason. Neither the operating system (Ubuntu 16.04) or Terraform (v0.11.3) have been customized with respect to those bash shell options.