Serverless Framework sls Conflicts with Powershell sls (Select-string)

I have installed a no-framework server using the following NPM command

npm install -g serverless

      

When I try to run the serverless command sls

in Powershell I get a strange result that mentions "cmdlet Select-string".

sls --version

      

enter image description here

Can anyone help me with this problem?

+3


source to share


1 answer


PowerShell seems to have a Select-String command / cmdlet aliased to sls. The PowerShell alias layer seems to take precedence over the node.js serverless sls command.

One way to remove the PowerShell sls alias is to run the following in PowerShell

Remove-Item alias:sls

      



This change only applies to the current PowerShell session.

To permanently replace the PowerShell sls alias, you can modify the Microsoft.PowerShell_profile.ps1 file.

From PowerShell, open your profile page in Notepad with the following command:

notepad $profile

      

Add the following to the file and save.

Remove-Item alias:sls

      



The profile can be reloaded by running the following from Powershell

. $profile

      

In my file, you will see that I have removed the curl and sls aliases.

Change PowerShell Profile

Now I can see what I expect when logging into sls in PowerShell. enter image description here

How can I remove the default remote Powershell alias?

--- Update ----

An easier option is to use the "serverless" command instead of "sls".

+5


source







All Articles