studiorack / studiorack-cli

Audio project manager for handling DAW VST plugin dependencies
https://studiorack.github.io/studiorack-site
MIT License
18 stars 1 forks source link

CLI errors out on plugin install #5

Closed sjoerdvankreel closed 2 months ago

sjoerdvankreel commented 3 months ago

Tested on windows.

Here's the output of my own plug firefly synth:

C:\Program Files\Microsoft Visual Studio\2022\Community>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\plugin.js:246
    plugin.paths.sort();
                 ^

TypeError: Cannot read properties of undefined (reading 'sort')
    at pluginInstall (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\plugin.js:246:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.<anonymous> (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\dist\plugin.js:42:30)

Node.js v18.20.2

Here's the output for vaporizer 2:

C:\Program Files\Microsoft Visual Studio\2022\Community>studiorack plugin install vastdynamics/vaporizer2/com.vastdynamics.vast2
C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@vscode\sudo-prompt\index.js:555
                error = new Error(
                        ^

Error: Command failed: node "C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\admin.js" --operation install --id vastdynamics/vaporizer2/com.vastdynamics.vast2 --ver undefined
C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\adm-zip\zipFile.js:107
                        throw new Error(Utils.Errors.INVALID_FORMAT);
                              ^

Error: Invalid or unsupported zip format. No END header found
    at readMainHeader (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\adm-zip\zipFile.js:107:10)
    at new module.exports (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\adm-zip\zipFile.js:23:3)
    at new module.exports (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\adm-zip\adm-zip.js:25:10)
    at zipExtract (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\file.js:306:17)
    at pluginInstall (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\plugin.js:197:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async init (C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\dist\admin.js:19:9)

Node.js v18.20.2

    at C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@vscode\sudo-prompt\index.js:555:25
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  code: 1
}

Node.js v18.20.2

Oddly, when I run it for firefly again, it seems successful, but nothing is installed into C:\Program Files\Common Files\VST3:

C:\Program Files\Microsoft Visual Studio\2022\Community>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.7   │ 2024-06-03 │ gpl-3.0 │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────┴───────────────────┘

Then when I try again with vaporizer, it errors out with the same message ('Error: Invalid or unsupported zip format. No END header found').

Maybe this got something to do with running on windows, or npm version?

kmturley commented 2 months ago

Hello, I have pushed a v2 version of the command line tool. Can you try again and see if the issue is fixed?

npm install @studiorack/cli -g
studiorack --version
studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth

Version should output as 2.0.0

sjoerdvankreel commented 2 months ago

The error is gone, but nothing gets installed (i.e. the plugin is not copied to C:\Program Files\Common Files\VST3). Can I run it in verbose mode or something to see what it is doing?

Here's the console output:


C:\Users\sjoerdk>studiorack --version
2.0.0

C:\Users\sjoerdk>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License
               │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘

C:\Users\sjoerdk>

[EDIT]: It just occurred to me that I might need to run a terminal as admin. Unfortunately that doesnt work either.

Here's the output from an as-admin powershell prompt:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\sjoerdk> studiorack plugin uninstall sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
studiorack : File C:\Users\sjoerdk\AppData\Roaming\npm\studiorack.ps1 cannot be loaded. The file
C:\Users\sjoerdk\AppData\Roaming\npm\studiorack.ps1 is not digitally signed. You cannot run this script on the current
system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ studiorack plugin uninstall sjoerdvankreel/firefly-synth/io.github.sj ...
+ ~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\sjoerdk> studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
studiorack : File C:\Users\sjoerdk\AppData\Roaming\npm\studiorack.ps1 cannot be loaded. The file
C:\Users\sjoerdk\AppData\Roaming\npm\studiorack.ps1 is not digitally signed. You cannot run this script on the current
system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoe ...
+ ~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\sjoerdk>

And here's the output from as-admin regular terminal (cmd.exe):

Microsoft Windows [Version 10.0.22631.3737]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>studiorack plugin uninstall sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
file:///C:/Users/sjoerdk/AppData/Roaming/npm/node_modules/@studiorack/cli/node_modules/@studiorack/core/build/plugin.js:290
        throw Error(`Plugin not found locally ${id}, ${version}`);
              ^

Error: Plugin not found locally sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth, undefined
    at pluginUninstall (file:///C:/Users/sjoerdk/AppData/Roaming/npm/node_modules/@studiorack/cli/node_modules/@studiorack/core/build/plugin.js:290:15)
    at async Command.<anonymous> (file:///C:/Users/sjoerdk/AppData/Roaming/npm/node_modules/@studiorack/cli/build/plugin.js:88:30)

Node.js v20.15.0

C:\Windows\System32>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License                 │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘

C:\Windows\System32>
kmturley commented 2 months ago

You can use the --log argument to see what is being downloaded

sjoerdvankreel commented 2 months ago

Here's the output.

Microsoft Windows [Version 10.0.22631.3737]
(c) Microsoft Corporation. All rights reserved.

C:\Users\sjoerdk>studiorack --log plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
error: unknown option '--log'

C:\Users\sjoerdk>studiorack plugin --log install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
error: unknown option '--log'

C:\Users\sjoerdk>studiorack plugin install --log sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
⤓ https://studiorack.github.io/studiorack-registry/v2/index.json
⌕ Program Files\Common Files\**\*.{component,aax,dll,clap,rta,lv2,sf2,sfz,tdm,vst,vst3}
⎋ Program Files\Common Files\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8\firefly_synth_1.json
⎋ Program Files\Common Files\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8\firefly_synth_1.vst3\Contents\x86_64-win\firefly_synth_1.json
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License
               │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘

C:\Users\sjoerdk>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth --log
⤓ https://studiorack.github.io/studiorack-registry/v2/index.json
⌕ Program Files\Common Files\**\*.{component,aax,dll,clap,rta,lv2,sf2,sfz,tdm,vst,vst3}
⎋ Program Files\Common Files\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8\firefly_synth_1.json
⎋ Program Files\Common Files\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8\firefly_synth_1.vst3\Contents\x86_64-win\firefly_synth_1.json
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License
               │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘

C:\Users\sjoerdk>
kmturley commented 2 months ago

When I run the commands on my VirtualBox Windows 10:

$ studiorack config get pluginFolder
test\tool

Then:

$ studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth --log

I get the plugin downloaded (with the entire folder)

Screenshot 2024-06-22 at 3 26 08 PM

Then uninstalling it worked fine:

$ studiorack plugin uninstall sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth --log

Looks to be correct no?

sjoerdvankreel commented 2 months ago

It is definately a permissions problem. If i switch plugin folder to a public writable directory, then all is well. Thing is, on windows, these files have to go into "program files". Either that, or user has to select additional vst3/clap folders in the host. But even when i "run as admin" the files don't get copied to the actual/required directory.

Here's the output if i switch plug folder to temp dir. So, progress, but still not usable for a non-tech-savvy-user. (BTW stuff now does get copied to my temp dir).

C:\Users\sjoerdk>studiorack config get pluginFolder
Program Files\Common Files

C:\Users\sjoerdk>studiorack config set pluginFolder c:\temp
c:\temp

C:\Users\sjoerdk>studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth --log
⤓ https://studiorack.github.io/studiorack-registry/v2/index.json
node "C:\Users\sjoerdk\AppData\Roaming\npm\node_modules\@studiorack\cli\node_modules\@studiorack\core\build\admin.js" --operation install --id sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License
               │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘

C:\Users\sjoerdk>
sjoerdvankreel commented 2 months ago

Btw are you testing virtualbox with linux host windows guest? I imagine that might have some discrepancies w.r.t. regular windows setup. I run a reverse setup (windows host linux guest) and it's bitten me more then once.

kmturley commented 2 months ago

I have two ways of testing:

I tested your theory in Program Files and that also appeared to work correctly

PS C:\Users\IEUser\Sites\studiorack-cli> studiorack config set pluginFolder "C:\Program Files\Test"
C:\Program Files\Test
PS C:\Users\IEUser\Sites\studiorack-cli> studiorack plugin listLocal
No results found
PS C:\Users\IEUser\Sites\studiorack-cli> studiorack plugin install sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth --log
⤓ https://studiorack.github.io/studiorack-registry/v2/index.json
node "C:\Users\IEUser\Sites\studiorack-cli\node_modules\@studiorack\core\build\admin.js" --operation install --id sjoerdvankreel/firefly-synth/io.github.sjoerdva
nkreel.firefly_synth
┌─────────────────────────────────────────────────────────────────────┬───────────────┬─────────┬────────────┬─────────────────────────┬───────────────────┐
│ Id                                                                  │ Name          │ Version │ Date       │ License                 │ Tags              │
├─────────────────────────────────────────────────────────────────────┼───────────────┼─────────┼────────────┼─────────────────────────┼───────────────────┤
│ sjoerdvankreel/firefly-synth/io.github.sjoerdvankreel.firefly_synth │ Firefly Synth │ 1.7.8   │ 2024-06-03 │ GNU General Public L... │ Instrument, Synth │
└─────────────────────────────────────────────────────────────────────┴───────────────┴─────────┴────────────┴─────────────────────────┴───────────────────┘
PS C:\Users\IEUser\Sites\studiorack-cli> ls 'C:\Program Files\Test\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8\'

    Directory: C:\Program Files\Test\VST3\sjoerdvankreel\firefly-synth\io.github.sjoerdvankreel.firefly_synth\1.7.8

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        6/25/2024   5:32 PM                firefly_synth_1.vst3
-a----        6/25/2024   5:32 PM           1623 firefly_synth_1.json

pluginInstall() has a step to elevate admin privileges to ensure there aren't permissions issues:

// If plugin installation path is outside dirAppData(), and program is not running as Admin,
// then trigger a pop-up to ask for elevated privileges, and run installation using cli.

https://github.com/studiorack/studiorack-core/blob/main/src/plugin.ts#L190

Can you confirm that you get a pop-up asking for admin privileges?

Screenshot 2024-06-25 at 5 39 17 PM
sjoerdvankreel commented 2 months ago

Yes I get the popup (didn't get it last time) and also it's fully working now! No idea what fixed it, might be something as simple as a reboot after installing node. Closing this issue, sorry for the inconvenience.

kmturley commented 2 months ago

Ah great news. No problem, I'm happy that there wasn't a bug ☺️