I'm unable to Authorize an Org from VSCode.
I'm getting the following error.
Starting SFDX: Authorize an Org
16:39:55.121 sfdx force:auth:web:login --setalias <org-name> --instanceurl https://login.salesforce.com --setdefaultusername
16:39:55.125 sfdx force:auth:web:login --setalias <org-name> --instanceurl https://login.salesforce.com --setdefaultusername
Salesforce CLI is not installed. Install it from https://developer.salesforce.com/tools/sfdxcli
I do have the Salesforce CLI installed and it has been added in the path; I've added the following line in my .bashrc
PATH="~/Workspace/sfdx/bin:$PATH"
I can directly run sfdx
from the terminal.
$ sfdx --version
sfdx-cli/7.132.0 linux-x64 node-v16.13.1
My OS is Ubuntu 20.04.3 LTS.
Best Answer
I was able to fix this issue by opening VSCode directly from my project folder as follows.
And then, from the integrated terminal, I ran the following command.
Not sure if this is the correct way but it fixed the issue.
Update #1
Looks like the issue was with the
PATH
variable. Once I set it to the absolute path ofsfdx
, it started to work.VSCode was giving issues if I used
~
.Now,
SFDX: Authorize an Org
command is working as expected.