LWC Basic challenge issue - Deploy - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Bruno PeixotoBruno Peixoto 

LWC Basic challenge issue - Deploy

I am trying to complete the challenge "Push and Deploy Lightning Web Component Files", LWC Basics module.
I managed to create the scratch org, push the e-bikes files, and the org is opening successfully, with the ebikes app and everything.
However, when I try to do another push, namely the BikeCard component that the module instructs, I receive the following message:
"The "path" argument must be of type string. Received type undefined"
That happens with sfdx:source:status, sfdx:source:push and sfdx:source:deploy...pretty much any source command is giving this error.
I looked at the project config files, but was unable to notice any path problems.
I did notice that CLI is in AppData foilder for some reason, but I do not know if that could be the culprit.
Using VS Code and CLI, latest versions.
I am new to DX, so I am probably doing something wrong. Could anyone help?
Best Answer chosen by Bruno Peixoto
Bruno PeixotoBruno Peixoto
Turn out I was able to solve it another way.
Still not really sure what I did, but this is what I can remember(did a lot of stuff, most of which did not work):

-Deleted project folder
-Created new project through sfdx
-Cloned the source from git
-Created a new scratch org
-In the force-app/main/default/lwc, created a new LWC through SFDX(previously, I had created the files manually, through VS Code-New File - I think this is what I did wrong)
-Used sfdx force:source:deploy(wrote it wrong in the post, but was using correct syntax already)

Anyway, problem solved, thanks!

All Answers

Kaustubh (KL) LabheKaustubh (KL) Labhe
Hey.

Does your sfdx-project.json file look like the below one?
Also just try 
sfdx force:source:deploy

{
"packageDirectories":[
{ "path": "force-app", "default": true
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "45.0"
}
Bruno PeixotoBruno Peixoto
Wow, that was fast! Thanks.

My sfdx-project file looks like this:
{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "EBikesLWC",
            "versionName": "Spring '19",
            "versionNumber": "1.0.0.NEXT"
        }
    ],
    "namespace": "",
    "sourceApiVersion": "45.0",
    "packageAliases": {
        "EBikesLWC": "0HoB0000000GmiYKAS",
        "EBikesLWC@1.0.0-3": "04tB0000000KAfOIAW"
    }
}
I tried using a relative path, but it did not change anything. Also, I have two of these files, this one is in the ebikes-lwc directory. Is that the one you were referring to?
I did try sfdx:source:deploy, it gave me the same error.
Kaustubh (KL) LabheKaustubh (KL) Labhe
Hey,

shouldnt the project have just one project.json file. Also check your syntax again. 
try sfdx force:source:deploy
not sfdx:source:deploy.

I dunno if it will help or not but try once.

Thx
Bruno PeixotoBruno Peixoto
Turn out I was able to solve it another way.
Still not really sure what I did, but this is what I can remember(did a lot of stuff, most of which did not work):

-Deleted project folder
-Created new project through sfdx
-Cloned the source from git
-Created a new scratch org
-In the force-app/main/default/lwc, created a new LWC through SFDX(previously, I had created the files manually, through VS Code-New File - I think this is what I did wrong)
-Used sfdx force:source:deploy(wrote it wrong in the post, but was using correct syntax already)

Anyway, problem solved, thanks!
This was selected as the best answer
Kaustubh (KL) LabheKaustubh (KL) Labhe
Wonderful Bruno. whatever works mate, as long as it solves the issue.
Bruce PerryBruce Perry
I'm seeing this problem too.  What do you think is the issue here? 

Does the ebikes app need to be placed in its own project?

Is it necessary to create the new files in the context of a project within VSCode using SFDX?  I too used "File | New".  The instructions don't detail what needs to happen here.

Does every Lightning Web Component need its own project?
 
Bruno PeixotoBruno Peixoto
Yes, it seems that you need to create a dedicated project for every Lightning Web Component, and creating the files through the File menu did not work for me.
Create the ebikes project, and create the files through SFDX commands. In my case, at least, the error went away.
Lynn GrandeLynn Grande
Adding this to my project json fixed it:
"packageDirectories":[
{ "path": "force-app", "default": true
}
],
Frederick LaneFrederick Lane
I am still struggling with it. My error message is"The "path" argument must be of type string. Received type undefined"
 
Wade LovellWade Lovell
My error message is also "The "path" argument must be of type string. Received type undefined"

Finally, I started from scratch. REMEMBER, you are supposed to be working in a local project directory "trail-comp".

Once I got to the point where we have all been having trouble, I created a new lightning web component: Ctrl+Shift+P --> SFDX: Create Lightning Web Component --> Enter (to confirm the directory is force-app/main/default/lwc), then edited the contents of bikeCard.html, bikeCard.js, and bikeCard.js-meta.xml to match the ones I had mistakenly created directly in VS Code earlier. I then moved the files I had created directly to the recycle bin.

You should skip all of the experiementation below and leave your project.json file alone.
I tried the sfdx force:source:deploy command suggested above and received a new error: "Missing one of the following parameters: manifest metadata sourcepath validateddeployrequestid".

Next, in the project.json file in the ebikes-lwc directory, I changed "path": "force-app", to have "default": true on the same line as Lynn Grande suggested above. Got the original error again.

Then I commented out the comma after the final ], namespace, and sourceApiVersion (not shown above in Lynn's answer but there from the start in my project.json file. Got the original error again.

Then I restored the file to the original state and changed "default": true to "default": false and, as expected, got:
In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: [{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]. After further experimentation with absolute path, extended relative path, etc., I abandoned this line.
Ethan GrangerEthan Granger
I've done the "Push and Deploy Lightning Web Component Files" 3 times from scratch clearing out all my files and all my previous scratch orgs. I've used sfdx commands to create all folders and files (using "Installing E-Bikes using a Scratch Org" from the github page). LWC deploys to scratch fine, but I continue to get the following set of errors (same error every time) when deploying to devhub (which is my playground org):
PROJECT PATH                                                          ERROR
────────────────────────────────────────────────────────────────────  ─────────────────────────────────────────────────────────────────────────────────────────
force-app\main\default\objects\Case\fields\Product__c.field-meta.xml  Cannot update a field to a Lookup, MasterDetail, or Hierarchy from something else (44:13)
force-app\main\default\sites\E_Bikes.site-meta.xml                    In field: siteAdmin - no User named test-yofedql671ah@example.com found
force-app\main\default\networks\E-Bikes.network-meta.xml              In field: Site - no CustomSite named E_Bikes found
force-app\main\default\networkBranding\cbE_Bikes.networkBranding      Network not found for the CustomBrand : cbE_Bikes
force-app\main\default\siteDotComSites\E_Bikes_C.site                 In field: Network - no Network named E-Bikes found
ERROR running force:source:deploy:  Deploy failed.
I feel like there needs to be some file that defines what is to be deployed, but the instructions don't make any mention of anything. Although instructions say, "You’re going to take the example from the previous unit and add it to the ebikes project." What does "add it to the ebikes project" mean?

Is the "ebikes project" the EBikes.app-meta.xml? Mine looks like (no changes from default):
<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <brand>
        <headerColor>#C23335</headerColor>
        <logo>logo</logo>
        <logoVersion>1</logoVersion>
        <shouldOverrideOrgTheme>false</shouldOverrideOrgTheme>
    </brand>
    <actionOverrides>
        <actionName>View</actionName>
        <comment>Action override created by Lightning App Builder on activation. Added manually because this isn't registered by force:source:pull.</comment>
        <content>Account_Record_Page</content>
        <formFactor>Large</formFactor>
        <skipRecordTypeSelect>false</skipRecordTypeSelect>
        <type>Flexipage</type>
        <pageOrSobjectType>Account</pageOrSobjectType>
    </actionOverrides>
    <formFactors>Large</formFactors>
    <label>E-Bikes</label>
    <navType>Standard</navType>
    <tabs>standard-home</tabs>
    <tabs>Product_Explorer</tabs>
    <tabs>standard-Account</tabs>
    <tabs>standard-Contact</tabs>
    <tabs>Product__c</tabs>
    <tabs>Order__c</tabs>
    <tabs>Product_Family__c</tabs>
    <uiType>Lightning</uiType>
</CustomApplication>
My sfdx-project.json looks like this (no changes from default):
{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true
        }
    ],
    "namespace": "",
    "sourceApiVersion": "46.0"
}

Thanks for the help
 
Wade LovellWade Lovell
There is a reference to Instructions in this thread. If you follow the reference you will find in those instructions you were supposed to 1) Delete the existing product__c picklist field on the Case object very early in the process. That is what is causing, “force-app\main\default\objects\Case\fields\Product__c.field-meta.xml Cannot update a field to a Lookup, MasterDetail, or Hierarchy from something else (44:13)“. 2) Put your user name where the placeholder, “test-yofedql671ah@example.com” is in the code. That is causing, “force-app\main\default\sites\E_Bikes.site-meta.xml In field: siteAdmin - no User named test-yofedql671ah@example.com found” My recollection is the other errors are resolved by fixing these two issues and deploying. Best wishes for a successful resolution, Wade Lovell aka Smokey Bear
Ethan GrangerEthan Granger
Thank you, Wade. Both of the above instructions are in the "Installing E-Bikes using a Developer Edition Org", but since I am using a scratch org, I didn't even look at those steps. :P

 
Wade LovellWade Lovell
Hi Ethan,
I was in exactly the same boat. Very frustrating.
Glad this thread now comes up in searches.
Knock it out of the park today,
Wade
alejo Luisalejo Luis
One of the issues I was having and thanks to aka Smokey Bear,  I didn't understand that: (1) you need to create a Lightning Web Component under the local trail-comp ( SFDX: Create Lightning Web Component ).  Once you do that it creates a folder bikeCard then (2) you modify the 3 files like the instructions say (html, js, js-meta.xml) then you (3) copy the entire folder to the ebikes-lwc folder :  ebikes-lwc\force-app\main\default\lwc.    (4) With that then pushing the code the scratch org was successful.  
Simon FischerSimon Fischer
Hi all,
When deploying the default folder including the bikeCard files to the Source Org it gets deployed to my dev org but not to the scratch org I created. Anytone has experienced the same?
Dev BoorlaDev Boorla
@Wade Lovell - Your solution worked like a charm! I deleted the Product field but got stumped with other errors. The Site Admin user name fixes other errors as well. Cannot thank you enough! :-)
Wade LovellWade Lovell
@Dev Boorla - That's fantastic news. Very glad to hear you could get out of that rut and carry on in the truly magnificent world of DX.
Ivanna PanchenkoIvanna Panchenko
Hi guys,
I've been stuck with this trail Push and Deploy Lighting Web Component Files (https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-basics/push-lightning-web-component-files)
I've read the READ.md File to follow the steps rightly.
I've chosen the following option:
-   [Installing E-Bikes using a Developer Edition Org](#installing-e-bikes-using-a-developer-edition-org)
Here is the new issue I found:
User-added image

ERROR running force:source:deploy:  Unexpected file found in package directory: C:\project\ebikes\ebikes-lwc\force-app\main\default\navigationMenus\Default_Navigation.navigationMenu-meta.xml

Have you had the same issue?
Can anyone help me to fix it?

I really appreciate your time.

Thanks!
Casey CrossCasey Cross
After I completed the steps Wade mentioned (Thank you Wade!!!) I got that error, then I just deleted that Navigation Menu file and that worked.  Not sure if we need it or not, just spent 2 hours trying to get through these million errors to complete a module that says it takes 15 mins :) 
Abhishek MallikAbhishek Mallik
While executing the below command:

    sfdx force:source:deploy -p force-app/main/default -u ebikesDE

Now I am getting below error:

    PROJECT PATH                                                              ERROR
    ────────────────────────────────────────────────────────────────────────  ──────────────────────────────────────────────────────────────────────────
    force-app/main/default/flexipages/Order_Record_Page.flexipage-meta.xml    You can't change a Lightning page's associated object.
    force-app/main/default/flexipages/Product_Record_Page.flexipage-meta.xml  You can't change a Lightning page's associated object.
    force-app/main/default/objects/Order__c/Order__c.object-meta.xml          0M02v000000vrBO does not exist or is not a valid override for action View.
    force-app/main/default/objects/Product__c/Product__c.object-meta.xml      0M02v000000vrBV does not exist or is not a valid override for action View.
    ERROR running force:source:deploy:  Deploy failed.
Victor UntilaVictor Untila

I had the same error: The "path" argument must be of type string. Received type undefined" when trying: 'sfdx force:source:push' comand. 

The solution for me was simply to create a folder (under lwc) named "BikeCard" and then move all the BikeCard files (html, json and xml) to this folder. Actually this passage is not specified in the trailhead, since it says only to create the files under the lwc folder (although in the picture of the project folder in the trailhead you can see clearly all the files are under the BikeCard folder). 

Hope this helps

Sara DiazSara Diaz