LWC エラーの対処方法3

+ [LWC エラーの対処方法に戻る](https://qiita.com/Keiji_otsubo/items/480135e98f6b0144ee63)
+ [LWC エラーの対処方法2](https://qiita.com/Keiji_otsubo/items/54983dba4eb802686a12)

# is not recognized as an internal or external command

+ [I am not able to install Salesforce CLI](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007YvifySAB)

:::note
1. Verify if Salesforce CLI is installed successfully or not. If Salesforce CLI is already installed, check the version number by running the command "sfdx --version" in the terminal. Make sure it is the latest version.

2. Add the path of the Salesforce CLI to the environmental variables. If updating Salesforce CLI does not fix the issue, try deleting the sfdx folder located at "C:\Users\username\AppData\Local\sfdx" and then reinstalling Salesforce CLI.

If none of the above steps work, try restarting VS Code and your machine.

Related:https://developer.salesforce.com/forums/?id=9062I000000DKBwQAO

https://github.com/forcedotcom/salesforcedx-vscode/issues/3459

https://github.com/forcedotcom/salesforcedx-vscode/issues/2869

https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4P9DSAV
:::

# npm install error in VS code terminal

+ [npm install error in VS code terminal](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ZBYzI)

:::note alert
PS C:\Users\orien\OneDrive\Documents\Dreamhouse SF> npm install

npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 

if a path was included, verify that the path is correct and try again.

At line:1 char:1
:::

:::note
Please check this article.

https://www.codewithharry.com/blogpost/solving-npm-not-recognized-error-windows/
:::

# VSCodeQuickstart\.sfdx 拡張子だけ？

+ [Why Does My SFDX Project Lack sObjects in VS Code?](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ZBuF3)

:::note alert
Starting SFDX: Refresh SObject Definitions

13:27:26.524 sfdx sobject definitions refresh Unable to process sObjects when not in an SFDX project c:\Users\keith\Documents\Trailhead\VSCodeQuickstart\.sfdx

13:27:26.527 sfdx sobject definitions refresh  ended with error Unable to process sObjects when not in an SFDX project c:\Users\keith\Documents\Trailhead\VSCodeQuickstart\.sfdx

13:27:26.527 sfdx sobject definitions refresh

 ended with exit code 1'
:::

:::note
 I had same issue, this solved for me:

1. ctrl + shift + p
2. sfdx: Refresh SObject Definitions
3. All Sobjects
:::

# The 'SearchGIPHY' component instance doesn't have an identifier specified.

+ [Metadata Problem with Project "Quick Start: Unlocked Packages"](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000HjmZb)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/ea2a376d-c46e-8236-9870-cafff8f4d9be.png)

:::note
Please check this article.

https://salesforce.stackexchange.com/questions/357206/problem-when-deploying-flexipages-on-winter-22-org-the-xxxx-component-in
:::


# “sf-x64.pkg” cannot be opened because it is from an unidentified developer.

+ [Cannot install Salesforce CLI on MaC](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007aipIdSAI)

:::note
once you double click on the package and it shows the error, use command + space to spotlight search and search for security and privacy. Once you are in security and privacy screen scroll down and you can see the sf-x64.pkg which you can open anyway and click on that and enter the password and you can install the same

パッケージをダブルクリックしてエラーが表示されたら、コマンド + スペースを使用してスポットライト検索を実行し、セキュリティとプライバシーを検索します。セキュリティとプライバシーの画面が表示されたら、下にスクロールすると sf-x64.pkg が表示されます。これを開いてクリックし、パスワードを入力すると、同じものをインストールできます。
:::

# The "path" argument must be of type string. Received undefined.

+ [Creating lightning web component 'helloWorld' and I am getting deploy source to org error.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007YwaeZSAR)

:::note
https://salesforce.stackexchange.com/questions/272976/how-can-i-fix-sfdx-error-the-path-argument-must-be-of-type-string-receive
:::

# sfdx org:open Warning: Ignoring extra certs from `null`, load failed: error:80000002:system library::No such file or directory

+ [sfdx org:open Warning: Ignoring extra certs from `null`, load failed: error:80000002:system library::No such file or directory](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007YwEcA)

:::note
 After trying many ways, I've solved the issue! The last method I did: First, I added the Salesforce CLI to the Windows %PATH, and then I also added it to the path of the Salesforce extension in Visual Studio Code. However, it still couldn't find the certificates. Later on, I downloaded them through the terminal command, not from Salesforce's official website (this might be a different approach due to setup). After adding them to %PATH again and integrating them into the Visual Studio Code extension, it worked! I'll post a proper update soon. 

https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007Vg8JDSAZ

いろいろ試した結果、問題が解決しました！最後に行った方法: まず、Salesforce CLI を Windows %PATH に追加し、次にそれを Visual Studio Code の Salesforce 拡張機能のパスにも追加しました。ただし、それでも証明書は見つかりませんでした。その後、Salesforce の公式 Web サイトからではなく、ターミナル コマンドを使用してダウンロードしました (これはセットアップにより異なるアプローチになる可能性があります)。これらを再度 %PATH に追加し、Visual Studio Code 拡張機能に統合すると、機能しました。すぐに適切なアップデートを投稿します。
:::

#  sfdx sobject definitions refresh  ended with error Unable to process sObjects when not in an SFDX project

+ [Why Does My SFDX Project Lack sObjects in VS Code?](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ZBuF3)

:::note
I found (at least part of) the answer in this page: 

https://developer.salesforce.com/docs/atlas.en-us.248.0.sfdx_setup.meta/sfdx_setup/sfdx_setup_move_to_sf_v2.htm

If you haven't done so already, update CLI from sfdx (v7) to sf (v2), then run the following command in a command prompt window: 

```
sf autocomplete --refresh-cache
```

If Visual Studio Code is open, close and reopen. Your project should now behave normally. I have had however to do this for two new projects so there is probably a script that needs updating. I'll continue to work this through.

```
sf autocomplete --refresh-cache
```

:::

+ [Cannot create scratch org](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007eqdgc)

:::note alert
org create scratch is not a sf command
:::

:::note
I did a clean install of the CLI and now it works. Should have tried that first, I guess.
:::


# LWC1079

+ [I'm getting VS Code Problem message "LWC1079: Expected root tag to be template, found lightning-card" when trying to fix HTML Template Errors from this](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007clIha)

:::note
Please check this article. 

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A97JESAZ
:::

# Error: Invalid Instance URL. It should not be a lightning domain.

+ [VSCode authorise an org Issue](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ajuZnSAI)

:::note
https://github.com/forcedotcom/cli/issues/2241

https://salesforce.stackexchange.com/questions/251589/unable-to-authorize-salesforce-org-using-sfdx-trailhead
:::


# error1ソースをデプロイまたは取得中にエラー: デプロイまたは取得しようとしたファイルかディレクトリが sfdx-project.json ファイルで指定されたパッケージディレクトリにありません。この場所を "packageDirectories" の値に追加するか、異なるファイルやディレクトリをデプロイまたは取得してください。sfdx-project.json についての詳細は https://developer.salesforce.com/docs/atlas.ja-jp.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm を参照してください。﻿undefined

+ [Apexファイルを組織にリリースする際に発生したエラーの解消方法をご教示お願いできますでしょうか](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007clV2E)

:::note
最終的にjavaのパスの通し忘れが原因だった事がわかりました。
:::


# Component [force:highlightsPanel] attribute [actionNames]: We couldn't validate Quick Action AXA_Cord__c.AXS_Delete

+ [Flexipages issue while deploying ([force:highlightsPanel] attribute [actionNames]: We couldn't validate Quick Action)](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007clenE)

:::note
The issue is resolved by adding

1. The Actions to QuickAction folder as metadata in vscode
2. The quick actions to the package.xml
:::

# Dataloader CLI

+ [Unable to export custom object data via Dataloader CLI]

:::note alert
<bean id="aor" class="com.salesforce.dataloader.process.ProcessRunner" scope="singleton">	<description>Export to CSV </description>	<property name="name" value="aor" />	<property name="configOverrideMap">		<map>			<entry key="sfdc.debugMessages" value="true"/>			<entry key="sfdc.endpoint" value="redacted"/>			<entry key="sfdc.Server host" value="redacted"/>			<entry key="sfdc.username" value="redacted"/>			<entry key="sfdc.password" value="redacted"/>			<entry key="process.encryptionKeyFile" value="C:\Users\matts\.dataloader\dataLoader.key"/>			<entry key="sfdc.timeoutSecs" value="600"/>			<entry key="sfdc.useBulkApi" value="true"/>			<entry key="sfdc.loadBatchSize" value="500"/>			   <entry key="sfdc.extractionRequestSize" value="10000"/>			<entry key="sfdc.entity" value="Account"/> 			<!-- SELECT * FROM HOURS-->			<entry key="sfdc.extractionSOQL" value="SELECT Account__c,Afternoon_Closing_Hour__c,Afternoon_Opening_Hour__c,Comments__c,CreatedById,                     CreatedDate,Day_of_Week__c,ExternalID__c,Frequency__c,Id,IsDeleted,LastActivityDate,                     LastModifiedById,LastModifiedDate,LastReferencedDate,LastViewedDate,Morning_Closing_Hour__c,                     Morning_Opening_Hour__c,Name,OwnerId,Product_Category__c,SystemModstamp,X24_7__c                     FROM Agency_Hours__c"/>			<entry key="process.operation" value="extract"/>			<entry key="dataAccess.name" value="C:\Users\matts\SF_DataLoader\Integration\aor.csv"/>			<entry key="dataAccess.type" value="csvWrite"/>		  </map>	</property></bean>Batch failed: InvalidBatch : Failed to process query: INVALID_TYPE_FOR_OPERATION: The root entity of the requested query (Agency_Hours__c) does not match the entity of the requested Bulk API Job (Account).2024-06-12 13:46:56,256 FATAL [main] process.ProcessRunner logErrorAndExitProcess (ProcessRunner.java:245) - Batch failed: InvalidBatch : Failed to process query: INVALID_TYPE_FOR_OPERATION: The root entity of the requested query (Agency_Hours__c) does not match the entity of the requested Bulk API Job (Account).
:::

:::note
1 つの Bean をエクスポート用に設定してから、気が狂ったようにコピー アンド ペーストを開始しました。XML 属性を設定するのを忘れていました。

I configured one bean for exporting, and then started copying and pasting like a mad man, I forgot to set the XML attribute

```
<entry key="sfdc.entity" value="Agency_Hours__c"/> 
```
:::


# SFDX コマンドが「コードのデバッグ」のコマンド パレットに表示されない

+ [SFDX commands not showing in command palette for 'Debug Your Code'](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007cm9dQ)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/496c1d05-4d9e-0cce-9ee4-96a25f0e9dc0.png)


:::note
最初にチェックポイントを作成するリンクをマークしてから、コマンドを探してください。

Please make sure you have marked the link first, that you want to make the checkpoint, and then try to find the command

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/4e33e28a-3609-cbde-698e-da27d8cb9c18.png)
:::


# AuthCodeExchangeError

+ [any solution to solve the AuthCodeExchangeError from vscode?](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007epeN8)

:::note alert
AuthCodeExchangeError

Error authenticating with auth code due to: request to https://empathetic-impala-obj66i-dev-ed.trailblaze.my.salesforce.com//services/oauth2/token failed, reason: self-signed certificate in certificate chain

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.
:::

:::note
Thx for the answer, and finally i found the reason of the problem is the proxy of my company. I can authorize the sandbox with wireless network of public internet. I'll inquiry the IT support of my company and close the ticket.

回答ありがとうございます。そしてついに、問題の原因が会社のプロキシにあることがわかりました。公衆インターネットの無線ネットワークでサンドボックスを認証できます。会社の IT サポートに問い合わせて、チケットをクローズします。
:::


# LWC1010: Failed to resolve entry for module "hKTrainingSampleEnglish".

+ [Calling Omniscript from LWC](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000E9iHk)

:::note
there is a mistake from salesforce end. In how to launch button what we get on embedded code is wrong because they are providing extra -(hyphon). you need to remove the extra -(hyphon) then it will work


Salesforce側に間違いがあります。ボタンを起動する方法では、埋め込みコードで得られるものは、余分な -(ハイフォン) を提供しているため、間違っています。余分な -(ハイフォン) を削除する必要があります。そうすれば機能します
:::

# Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}apiVersion invalid at this location in type Document

+ [【未解決】Error parsing file: Element {http://soap.sforce.com/2006/04/metadata}apiVersion invalid at this location in type Document](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007eqWbG)

Windowsだけエラーになるらしい


# The engine "node" is incompatible with this module. Expected version "^18.18.0 || >=20.0.0". Got "18.15.0"

+ [SFDX Scanner Installation Error in VS Code](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007ifcRbSAI)

:::note
CLI をアンインストールしてもう一度実行したところ、正常に動作しました。迅速かつ親切なサポートに感謝します。本当に感謝しています。
:::

# sf:INSUFFICIENT_ACCESS: INSUFFICIENT_ACCESS: use of the Metadata API requires a user with the ModifyAllData or ModifyMetadata permissions

+ [sf:INSUFFICIENT_ACCESS: INSUFFICIENT_ACCESS: use of the Metadata API requires a user with the ModifyAllData or ModifyMetadata permissions](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000PeS1J)

:::note
you need to have access to metadata type for your profile

pls check the screenshot and see if your profile has access to those metadata types 

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/a05dec6c-5038-4fe0-96da-41c27cd931ee.png)

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A92UZSAZ
:::

# Error: [LWC error]: that use the `lwc:dom="manual"` - adding columns to datatable

+ [Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007UqI0m)

:::note
Please check this article. 

https://salesforce.stackexchange.com/questions/357400/error-lwc-error-that-use-the-lwcdom-manual-adding-columns-to-datatabl
:::

# Cannot find Lightning Component Bundle VSCodeQuickstart.

+ [Deploying source to Org is failing](https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000MadRf)

:::note
Can you change the project name as mentioned in this scenario and see if it helps-

https://github.com/forcedotcom/salesforcedx-vscode/issues/3823Related: https://salesforce.stackexchange.com/questions/250154/lwc-push-fails-with-error-cannot-find-lightning-component-bundle-selector

https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T42KHSAZ
:::

# package is not a sf command?

+ [Stuck on project deployment to newly created scratch org.](https://trailhead.salesforce.com/trailblazer-community/feed/0D5KX00000TlCaE)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/5520e23c-e057-4e39-8cbb-662a4e846871.png)

:::note
Please check this article. 


https://salesforce.stackexchange.com/questions/398788/package-is-not-a-sf-command
:::