You need to sign in to do that
Don't have an account?
Dwayne Jackson
How to resolve - LWC1011: Failed to resolve import "../ldsUtils/ldsUtils" from "accountList.js". in the Handle Server Error Trailhead
Hi, I'm implementing the Lightning Web Components and Salesforce Data -> Handle Server Errors part of theTrailhead module.
The instructions say…
Handle Errors in the accountList Component
Let’s add error handling to the accountList component that you created.
My issue is in step 2 and 3. I copied the ldsUtils component as instructed, but following problem shows up in Visual Studio Code Output panel and I cannot deploy it to my dev instance:
=== Deploy Errors
PROJECT PATH ERRORS
──────────── ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
LWC1011: Failed to resolve import "../ldsUtils/ldsUtils" from "accountList.js". Please add "../ldsUtils/ldsUtils" file to the component folder.
So I changed the import in the accountList.js from:
import { reduceErrors } from 'c/ldsUtils';
To
import { reduceErrors } from '../ldsUtils/ldsUtils';
The ldsUtils component is in the same component folder as the rest of my LWC components, which is:
C:\...lwc-tutorials\workingWithDataInLWC\force-app\main\default\lwc\ldsUtils
Any help as to what I'm doing is wrong. Thanks in advance.
The instructions say…
Handle Errors in the accountList Component
Let’s add error handling to the accountList component that you created.
- In the accountList.html file, after the <template> that includes the lightning-datatable, add this code:
<template if:true={errors}>
<p>{errors}</p>
</template>
Copy - Copy the ldsUtils component from LWC recipes and include it in the force-app/main/default/lwc folder in your project. This component contains the reduceErrors function.
- Import the reduceErrors function near the beginning of accountList.js.
import { reduceErrors } from 'c/ldsUtils';
Copy - In accountList.js, insert this getter, which defines an errors property:
get errors() {
return (this.accounts.error) ?
reduceErrors(this.accounts.error) : [];
}
Copy
My issue is in step 2 and 3. I copied the ldsUtils component as instructed, but following problem shows up in Visual Studio Code Output panel and I cannot deploy it to my dev instance:
=== Deploy Errors
PROJECT PATH ERRORS
──────────── ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
LWC1011: Failed to resolve import "../ldsUtils/ldsUtils" from "accountList.js". Please add "../ldsUtils/ldsUtils" file to the component folder.
So I changed the import in the accountList.js from:
import { reduceErrors } from 'c/ldsUtils';
To
import { reduceErrors } from '../ldsUtils/ldsUtils';
The ldsUtils component is in the same component folder as the rest of my LWC components, which is:
C:\...lwc-tutorials\workingWithDataInLWC\force-app\main\default\lwc\ldsUtils
Any help as to what I'm doing is wrong. Thanks in advance.
Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)can provide assistance for situations where Trailhead does not appear to be functioning correctly. You can reach out to them if this is the case.
Thanks,
Kindly reach out trailhead team (https://trailhead.salesforce.com/en/help?support=home) and they can help you.
Please mark as Best Answer if above information was helpful so that it can help others in the future.
Thanks,
Were you able to clear this badge buddy? I'm facing the same issue.
https://semut-ireng-stone.webflow.io/
https://semutirengstone6.blogspot.com/
https://semutirengstone6.wixsite.com/semut-ireng-stone
https://semutirengstone.mystrikingly.com/
http://semutirengstone.wikidot.com/
https://fruirty-spluoct-thorg.yolasite.com/tentang-kami/
https://semutirengstone6.page.tl/
Konsultan seo indonesia (https://iswanto.com) pelatihan baby spa (https://informasipelatihan.com) bata tempel expose (https://rumahbatatempel.com) jasa sablon kaos (https://jasasablonjogja.com)
I'm facing the same issue.
****Step2: Paste the Below Code as given in ldsUtils.js **** Step3: Don't make any changes in "ldsUtils.html" and "ldsUtils.js-meta.xml" files
Step4: Deploy the "ldsUtils" Component to your Org
Step5: After this deploy the component in which you mentioned "ldsUtils"as "import { reduceErrors } from 'c/ldsUtils';"
Step6: Your issue is resolved