let { execSync: exec } = require('child_process');
let os = require('os');
let tmp = os.tmpdir();
exec(`npm install --prefix ${tmp}`, {
cwd: './',
encoding: 'utf8',
stdio: 'inherit'
});
child_process.js:531
throw err;
^
Error: spawnSync /bin/sh ENOENT
at exports._errnoException (util.js:1026:11)
at spawnSync (child_process.js:466:20)
at execSync (child_process.js:522:13)
at Cache.installModules (/index.js:173:3)
at Object.<anonymous> (/install.js:11:7)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
Please read my another issue before
/bin/sh
exist on your system? Can you run /bin/sh -c ls
manually in a shell?exec
programs than npm, e.g. ls
?Does /bin/sh exist on your system?
Can you run /bin/sh -c ls manually in a shell?
Yep
Does that problem also occur when you try to exec programs than npm, e.g. ls?
No and I haven't seen that before. It's reproduced only with npm install ...
or I didn't see what you mean.... Can you provide an example?
Closing for lack of activity.
@monolithed we can reopen if you are still experiencing this issue.
I encounter the same error message in a Debian server, and it was due to a typo in cwd option pass to exec: the directory where not existing.
Maybe the error message could be enhanced...
Same here : directory didn't exist
See the feature request in #11520.
options.shell: trueï¼› perhaps can solved it
Most helpful comment
I encounter the same error message in a Debian server, and it was due to a typo in cwd option pass to exec: the directory where not existing.
Maybe the error message could be enhanced...