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
Can anyone help me with this problem?
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.
Now I can see what I expect when logging into sls in PowerShell.
How can I remove the default remote Powershell alias?
--- Update ----
An easier option is to use the "serverless" command instead of "sls".