koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.15k stars 247 forks source link

Fix plugin NPM dependencies failing to install on Windows with path containing space #1517

Closed longzheng closed 3 months ago

longzheng commented 3 months ago

Fixes https://discord.com/channels/882329362295316500/932852072024518726/1256029193842593913

Similar to https://github.com/koush/scrypted/pull/1471 but fixes plugin install calling npm --prefix ... install (which I wasn't aware of before) in a Windows path containing space which had an error

I reproed the issue and here was the log which led me to the issue

plugin start/fork failed Error: npm installation failed with exit code 1
    at installOptionalDependencies (C:\Users\john doe\.scrypted\node_modules\@scrypted\server\dist\plugin\plugin-npm-dependencies.js:78:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.onLoadZip (C:\Users\john doe\.scrypted\node_modules\@scrypted\server\dist\plugin\plugin-remote-worker.js:266:13)
    at async Object.loadZip (C:\Users\john doe\.scrypted\node_modules\@scrypted\server\dist\plugin\plugin-remote.js:588:28)
    at async RpcPeer.handleMessageInternal (C:\Users\john doe\.scrypted\node_modules\@scrypted\server\dist\rpc.js:602:37)