cli icon indicating copy to clipboard operation
cli copied to clipboard

Parent directory named 'lwc' outside the app directory causes deploy to fail with cryptic message.

Open dbreese opened this issue 3 years ago • 2 comments

Summary

A parent directory named 'lwc' will cause deployments to fail with cryptic error message:

$ pwd 
~/projects/lwc/TestApp

$ sfdx force:source:deploy -p force-app/main/default/lwc
*** Deploying with SOAP API v53.0 ***
Deploy ID: 0Afx000000012nDCAQ
DEPLOY PROGRESS | ████████████████████████████████████████ | 1/1 Components

=== Component Failures [1]
Type   Name     Problem
─────  ───────  ────────────────────────────────────────────────────────────────────────────────────────
Error  TestApp  Unable to build Lightning Component source for markup://c:TestApp: Invalid suffix: json.

ERROR running force:source:deploy:  Deploy failed.

** Even parent directories up the dir tree named "lwc" will cause the issue too. For example, ~/dev/lwc/someother/someother2/someother3/MyApp.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Create a parent directory to contain 1 or more apps. For example, ~/dev/lwc
  2. cd ~/dev/lwc
  3. Create any force app and authorize an org
$ sfdx force:project:create -n TestApp
$ cd TestApp
$ sfdx auth:web:login -a LocalHostDevHub -r https://localhost:6101 -s
Successfully authorized [email protected] with org ID 00Dxx0000006H7bEAE
  1. Create a skeleton LWC:
$ sfdx force:lightning:component:create -n myTest --type lwc -d force-app/main/default/lwc
  1. Attempt to deploy and you will see the issue:
$ sfdx force:source:deploy -p force-app/main/default/lwc/myTest

Expected result

Should deploy.

Actual result

Cryptic error message is shown:

Error  TestApp  Unable to build Lightning Component source for markup://c:TestApp: Invalid suffix: json.

System Information

sfdx version --verbose --json
{
	"cliVersion": "sfdx-cli/7.136.2",
	"architecture": "darwin-x64",
	"nodeVersion": "node-v16.13.1",
	"pluginVersions": [
		"@oclif/plugin-autocomplete 0.3.0 (core)",
		"@oclif/plugin-commands 1.3.0 (core)",
		"@oclif/plugin-help 3.3.1 (core)",
		"@oclif/plugin-not-found 1.2.6 (core)",
		"@oclif/plugin-plugins 1.10.11 (core)",
		"@oclif/plugin-update 1.5.0 (core)",
		"@oclif/plugin-warn-if-update-available 1.7.3 (core)",
		"@oclif/plugin-which 1.0.4 (core)",
		"@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
		"alias 1.2.0 (core)",
		"apex 0.8.0 (core)",
		"auth 1.8.1 (core)",
		"config 1.3.15 (core)",
		"custom-metadata 1.0.12 (core)",
		"data 0.6.8 (core)",
		"generator 1.2.1 (core)",
		"info 1.2.0 (core)",
		"limits 1.3.0 (core)",
		"org 1.11.1 (core)",
		"salesforce-alm 53.7.6 (core)",
		"schema 1.1.0 (core)",
		"sfdx-cli 7.136.2 (core)",
		"source 1.8.9 (core)",
		"telemetry 1.4.0 (core)",
		"templates 53.3.0 (core)",
		"trust 1.1.0 (core)",
		"user 1.7.0 (core)"
	],
	"osVersion": "Darwin 21.3.0"
}

dbreese avatar Feb 08 '22 17:02 dbreese

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar Feb 08 '22 17:02 github-actions[bot]

This issue has not received a response in 60 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Sep 21 '22 19:09 github-actions[bot]

I believe this is fixed as of ➜ sf -v @salesforce/cli/2.1.7 darwin-arm64 node v18.16.0

 ➜  mkdir lwc                        
➜  scratches 
 ➜  cd lwc         
➜  lwc 
 ➜  sfdx force project create -n TestApp                             
Warning: The "force project create" command has been deprecated. Use "project generate" instead.
target dir = /Users/william.ruemmele/projects/scratches/lwc
   create TestApp/config/project-scratch-def.json
   create TestApp/README.md
   create TestApp/sfdx-project.json
   create TestApp/.husky/pre-commit
   create TestApp/.vscode/extensions.json
   create TestApp/.vscode/launch.json
   create TestApp/.vscode/settings.json
   create TestApp/force-app/main/default/lwc/.eslintrc.json
   create TestApp/force-app/main/default/aura/.eslintrc.json
   create TestApp/scripts/soql/account.soql
   create TestApp/scripts/apex/hello.apex
   create TestApp/.eslintignore
   create TestApp/.forceignore
   create TestApp/.gitignore
   create TestApp/.prettierignore
   create TestApp/.prettierrc
   create TestApp/jest.config.js
   create TestApp/package.json

➜  lwc 
 ➜  cd TestApp 
➜  TestApp 
 ➜  oc

Creating Scratch Org... 
RequestId: 2SR3i0000008Z3QGAU (https://brave-bear-5fmf7j-dev-ed.my.salesforce.com/2SR3i0000008Z3QGAU)
OrgId: 00DDC0000004Hup 
Username: [email protected] 
✓ Prepare Request
✓ Send Request
✓ Wait For Org
✓ Available
✓ Authenticate
✓ Deploy Settings
Done

Your scratch org is ready.
➜  TestApp  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜   sfdx force:lightning:component:create -n myTest --type lwc -d force-app/main/default/lwc 
Warning: The "force lightning component create" command has been deprecated. Use "lightning generate component" instead.
target dir = /Users/william.ruemmele/projects/scratches/lwc/TestApp/force-app/main/default/lwc
   create force-app/main/default/lwc/myTest/myTest.js
   create force-app/main/default/lwc/myTest/myTest.html
   create force-app/main/default/lwc/myTest/__tests__/myTest.test.js
   create force-app/main/default/lwc/myTest/myTest.js-meta.xml

➜  TestApp  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  sfdx force:source:deploy -p force-app/main/default/lwc/myTest
Warning: We plan to deprecate this command in the future. Try using the "project deploy start" command instead.
Deploying v58.0 metadata to [email protected] using the v58.0 SOAP API.
Deploy ID: 0AfDC00000iheGJ0AY
DEPLOY PROGRESS | ████████████████████████████████████████ | 1/1 Components

=== Deployed Source

 FULL NAME TYPE                     PROJECT PATH                                         
 ───────── ──────────────────────── ──────────────────────────────────────────────────── 
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.html        
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.js          
 myTest    LightningComponentBundle force-app/main/default/lwc/myTest/myTest.js-meta.xml 
Deploy Succeeded.
➜  TestApp  hub:(GLOBAL - DevHub) scratch:([email protected])
 ➜  pwd 
/Users/william.ruemmele/projects/scratches/lwc/TestApp

WillieRuemmele avatar Jul 31 '23 22:07 WillieRuemmele