Unable to run SOQL queries on VSCode. I'm getting the following error.
Starting SFDX: Execute SOQL Query...
19:33:27.886 sfdx force:data:soql:query --query SELECT Id, Name FROM Account
19:33:27.888 sfdx force:data:soql:query --query SELECT Id, Name FROM Account
Salesforce CLI is not installed. Install it from https://developer.salesforce.com/tools/sfdxcli
But if I run the above command directly from the integrated terminal, it executes.
$ sfdx force:data:soql:query --query "SELECT Id, Name FROM Account"
ID NAME
────────────────── ───────────────────────────────────
0015f00000HkEKZAA3 Sample Account for Entitlements
0015f00000I8QV5AAN GenePoint
0015f00000I8QV3AAN United Oil & Gas, UK
0015f00000I8QV4AAN United Oil & Gas, Singapore
0015f00000I8QUvAAN Edge Communications
0015f00000I8QUwAAN Burlington Textiles Corp of America
0015f00000I8QUxAAN Pyramid Construction Inc.
0015f00000I8QUyAAN Dickenson plc
0015f00000I8QUzAAN Grand Hotels & Resorts Ltd
0015f00000I8QV1AAN Express Logistics and Transport
0015f00000I8QV2AAN University of Arizona
0015f00000I8QV0AAN United Oil & Gas Corp.
0015f00000I8QV6AAN sForce
Total number of records retrieved: 13.
Querying Data... done
I faced a similar issue when Authorizing the Org. Refer to: Unable to Authorize an Org in VSCode
My OS is Ubuntu 20.04.3 LTS.
Best Answer
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, the
SFDX: Execute SOQL Query...
command is working as expected.