function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vladimir BessonovVladimir Bessonov 

"message": "No matching source was found within the package root directory:

I am trying to deploy package to Sandbox and getting the following error 
 
"message": "No matching source was found within the package root directory:

I run command in vscode 
 
sfdx force:package:version:create --targetdevhubusername DevHub --package 0Ho1W000000XXXXXXXX --versionnumber 1.0.0.NEXT --installationkeybypass --wait 10 --json

{
  "status": 1,
  "name": "Error",
  "message": "No matching source was found within the package root directory: /Users/01_Salesforce/CICD/app/force-app",
  "exitCode": 1,
  "commandName": "PackageVersionCreateCommand",
  "stack": "Error: No matching source was found within the package root directory: /Users/01_Salesforce/CICD/app/force-app\n
.....
I used the same template before another unlocked package. It is working with no issue. 
I cannot figure out why this happened in the first place and how to resolve it.

P.S. it is a new package I try to deploy. I created based on my previous template. 
It ways on the state of package creation. 
 
ShirishaShirisha (Salesforce Developers) 
Hi Vladimir,

Greetings!

I would suggest you to double check the path again since the error itself indicates that the source was not found in the path "/Users/01_Salesforce/CICD/app/force-app".

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Gary Chen 9Gary Chen 9

Hi Vladimir,

Make sure you have some official files(like apex classes) in the force-app folder, then try it again.

Regards,
Gary Chen

jj k 6jj k 6
Hi Vladimir,

I met this issue as well, I struggled very long time, finally figured out, you need to reinstall Salesforce cli(It's better to unintall plugins relative to salesforce if you use Visual Studio Code)

I found this is version issue, 7.81.0 works well

Before install
sfdx-cli/7.85.1-2fb9e41053 win32-x64 node-v12.18.3
After reinstall
sfdx-cli/7.81.0-7b953c80d1 win32-x64 node-v12.18.3


Regards
Kyle Wright 14Kyle Wright 14
Missing official files, as pointed out by Gary, was what was causing this issue for me.