Fixing Cannot find module ‘sync-exec’ error with yarn install

Error message:
clientResources\node_modules\uglifyjs-webpack-plugin: Command failed. Cannot find module ‘sync-exec’
Reason:
uglifyjs-webpack-plugin 0.4.6 defines this command 
“postinstall”: “node lib/post_install.js”
which looks like this
var execSync = require('child_process').execSync;
var fs = require('fs');

// Node 0.10 check
if (!execSync) {
execSync = require('sync-exec');
}

So if your node instance is older than 0.10, it will fallback to require sync-exec . Unlike execSync which is a builtin module, sync-exec is, or was an old module that you have to install explicitly. If your node instance does not have that installed, boom!

Continue reading “Fixing Cannot find module ‘sync-exec’ error with yarn install”