sfdx force:source:deploy -p "c:\my stuff\code\MyProject\sfdc\classes\SidebarController.cls"
ERROR running force:source:deploy: Cannot read property 'path' of undefined
Run the command line
File should deploy
ERROR running force:source:deploy: Cannot read property 'path' of undefined
sfdx-cli/7.65.4-c99e705754 win32-x64 node-v12.13.0
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.0.1 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.7.10 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-diff 0.0.6
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.12.0 (core)
generator 1.1.3 (core)
salesforcedx 48.22.8 (core)
鈹溾攢 salesforcedx-templates 48.18.0 (core)
鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
鈹溾攢 salesforce-alm 48.24.1 (core)
鈹斺攢 custom-metadata 1.0.4 (core)
sfdx-cli 7.65.4 (core)

Seeing the same issue here, seems to be inconsistent as well. --verbose --loglevel=debug not giving away anything interesting either.
Actually I think this is an issue with the logic used to find the project's sfdx-project.json file. If I run the deploy command from the directory the sfdx-project.json file is in, it will deploy, but if I'm in a subdirectory of my project and run the command it fails with ERROR running force:source:deploy: Cannot read property 'path' of undefined.
This used to work fine when running deploys with full paths in a project subdirectory.
What @JonnyPower said. Our script used to push from subfolder of sfdx project, now that fails.
force:mdapi:convert is also broken with same issue. Was working perfectly fine 2 weeks ago.
We're getting the same when running sfdx force:source:push -f -g --loglevel DEBUG --dev-debug
sfdx:SourcePushCommand ERROR [
sfdx:SourcePushCommand '\u001b[1mERROR running force:source:push: \u001b[22m',
sfdx:SourcePushCommand "\u001b[31mCannot read property 'path' of undefined\u001b[39m",
sfdx:SourcePushCommand '\u001b[31m\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m*** Internal Diagnostic ***\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m\u001b[39m\n' +
sfdx:SourcePushCommand "\u001b[31mTypeError: Cannot read property 'path' of undefined\u001b[39m\n" +
sfdx:SourcePushCommand '\u001b[31m at /home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/packageInfoCache.js:49:33\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at Array.map (<anonymous>)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at PackageInfoCache.buildPackageList (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/packageInfoCache.js:44:38)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at PackageInfoCache.init (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/packageInfoCache.js:22:36)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at Function.create (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/packageInfoCache.js:18:18)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at Function.getInstance (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/packageInfoCache.js:35:58)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at SourceWorkspaceAdapter.init (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/sourceWorkspaceAdapter.js:60:69)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Function.create (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@salesforce/kit/lib/creatable.js:20:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async MdapiPushApi.init (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/sourcePushApi.js:29:20)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Function.create (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@salesforce/kit/lib/creatable.js:20:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31mFrom previous event:\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at processImmediate (internal/timers.js:439:21)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31mFrom previous event:\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at SourceApiCommand.execute (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/lib/source/sourceApiCommand.js:47:14)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at SourcePushCommand.execLegacyCommand (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/ToolbeltCommand.js:148:43)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async SourcePushCommand.run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/commands/force/source/push.js:25:16)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async SourcePushCommand._run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:93:40)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Config.runCommand (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/config/lib/config.js:172:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Main.run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/command/lib/main.js:22:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Main._run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/command/lib/command.js:43:20)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Object.run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/dist/cli.js:32:20)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31mOuter stack:\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at Function.wrap (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at SourcePushCommand.catch (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/dist/ToolbeltCommand.js:247:46)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async SourcePushCommand._run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Config.runCommand (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/config/lib/config.js:172:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Main.run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/command/lib/main.js:22:9)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Main._run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/node_modules/@oclif/command/lib/command.js:43:20)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m at async Object.run (/home/lorena/.local/share/sfdx/client/7.66.2-4f159a1d07/dist/cli.js:32:20)\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m******\u001b[39m\n' +
sfdx:SourcePushCommand '\u001b[31m\u001b[39m'
sfdx:SourcePushCommand ] +678ms
I do confirm that the workaround that @JonnyPower mentioned (pushing from the root and not a sub directory) also works for us. Was working fine ~2 weeks ago.
Yes deploying from root is fine, but not from sub directories. This is really messing with our CI and needs to be fixed ASAP.
Same issue here.
I'm using sfdx-cli on Windows 10 installed via NPM on NodeJs installed via Scoop package manager.
Source commands invoked from project sub-directories fail, whilst commands invoked from project root work just fine.
This needs to be fixed ASAP, especially since older versions of the CLI did not have this problem IIRC.
Log output:
status: 1
name: TypeError
message: Cannot read property 'path' of undefined
exitCode: 1
commandName: SourceDeployCommand
stack: TypeError: Cannot read property 'path' of undefined
at C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\packageInfoCache.js:49:33
at Array.map (<anonymous>)
at PackageInfoCache.buildPackageList (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\packageInfoCache.js:44:38)
at PackageInfoCache.init (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\packageInfoCache.js:22:36)
at Function.create (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\packageInfoCache.js:18:18)
at Function.getInstance (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\packageInfoCache.js:35:58)
at SourceWorkspaceAdapter.init (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\sourceWorkspaceAdapter.js:60:69)
at async Function.create (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\@salesforce\kit\lib\creatable.js:20:9)
at async SourceDeployApi.doDeploy (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\lib\source\sourceDeployApi.js:50:20)\nOuter stack:
at Function.wrap (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\node_modules\@salesforce\core\lib\sfdxError.js:151:27)
at SourceDeployCommand.catch (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\dist\ToolbeltCommand.js:247:46)
at async SourceDeployCommand._run (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\salesforce-alm\node_modules\@salesforce\command\lib\sfdxCommand.js:97:13)
at async Config.runCommand (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\@oclif\config\lib\config.js:172:9)
at async Main.run (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\@oclif\command\lib\main.js:22:9)
at async Main._run (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\node_modules\@oclif\command\lib\command.js:43:20)
at async Object.run (C:\Users\gerar\scoop\persist\nodejs\bin\node_modules\sfdx-cli\dist\cli.js:32:20),
warnings: []
I'm no expert on NodeJS-based apps, but maybe fixing some of those deprecation warnings that pop up when installing/upgrading the sfdx-cli could help?

The fix will be in this week's release, scheduled for today. Thanks for your patience.
@gvkempen The deprecation warnings have nothing to do with the error during deploy. None of them are direct plugin dependencies but rather transitive deps which require fixing in other projects. That said, we definitely want to address them as soon as we can. Version bumps are easier to deal with than switching modules entirely, but it all requires investigation, implementation, and testing. It's a matter of priorities, and the bug listed here is just one of many with much higher priority.
FYI: The new build has solved the issue for me. Thanks
Thank you for confirming.
Seems working fine now.
Most helpful comment
Actually I think this is an issue with the logic used to find the project's sfdx-project.json file. If I run the deploy command from the directory the sfdx-project.json file is in, it will deploy, but if I'm in a subdirectory of my project and run the command it fails with
ERROR running force:source:deploy: Cannot read property 'path' of undefined.This used to work fine when running deploys with full paths in a project subdirectory.