npm install command failed in Windows Subsystem for Linux (Ubuntu) with following exceptions.
$npm install
> spawn-sync@1.0.15 postinstall /root/projects/../../node_modules/spawn-sync
> node postinstall
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/root/projects/../../node_modules/spawn-sync/postinstall'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.15 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-10T23_57_26_568Z-debug.log
Solution
Run npm install with allow root params
$npm install --unsafe-perm=true --allow-root