sveltejs / cli

The Svelte CLI
MIT License
258 stars 11 forks source link

`sv` in windows powershell conflicts with `Set-Variable` #317

Open Paillat-dev opened 4 days ago

Paillat-dev commented 4 days ago

In powershell, sv is an alias to Set-Variable. Thus I cannot use npx sv as that conflicts with the alias which takes precedence. And the alias can for some reason not be removed, when I remove it with Remove-Item Alias:sv -Force it comes back directly afterwards.

How can I use npx sv then ?

jackvanderbilt-visma commented 4 days ago

This does not happen in my powershell, and shouldn't happen in any; though I am not using PowerShell v7. Can you share a screenshot of your terminal running just npx sv, or just the logs nicely formatted?

Paillat-dev commented 4 days ago

image

jackvanderbilt-visma commented 3 days ago

Try npx "sv" instead

Paillat-dev commented 3 days ago

same thing image

manuel3108 commented 3 days ago

This is strange. I'm developing sv on a daily basis on Windows inside Powershell, and never experienced this. Also you are the first person reporting since the tool was published about 30 days ago.

I'm not saying the problem does not exist, I'm just trying to explain that this seems to be some kind of edge case and not a global problem.

Also I'm not sure why ps kicks in for something that is obviously not the first argument.

Edit: Relates #259

Paillat-dev commented 3 days ago

I also had it working just fine and at some point it just broke and started doing this. I don't think I installed anything that would have changed that either.

Paillat-dev commented 3 days ago

Also, unlike the related issue you mentioned, running npx sv@latest doesn't change anything.

Paillat-dev commented 3 days ago

Currently, to use sv I had to install it globally with npm then use C:\Users\Jérémie\AppData\Roaming\npm\sv

manuel3108 commented 3 days ago

Could you please run $PSVersionTable and paste the result? This is the result for me

Name                           Value
----                           -----
PSVersion                      5.1.22621.4391
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.4391
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Paillat-dev commented 3 days ago

Sure:

Name                           Value
----                           -----
PSVersion                      5.1.22621.4249
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.4249
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
jackvanderbilt-visma commented 1 day ago

Could it be that npx just defaults to running sv because it can't find the sv package on your system? Somehow that this is configured npx behavior on your system or something similar?

~What happens when you npm install sv -g and then try npx sv?~ just saw your previous response, so nevermind this question.