LoginSignup
0
0

LWC エラーの対処方法

Last updated at Posted at 2022-10-25

Salesforce Extensions for VSCodeの使用中に発生する可能性のある障害を乗り越える方法に関する情報を以下に示します。


ENOENT: no such file or directory

dreamhouse-lwc ディレクトリからコマンドを実行する必要があります

問題はフォルダの構造に関連していました。

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

LWCという空間名は使えないみたい

No authorization information found for VSCodePlayground

I also faced the same issue. Restarting the VS Code worked for me.

私も同じ問題に直面しました。VS Code を再起動するとうまくいきました。

'Metadata API request failed: Component conversion failed: FILE_ENDED'.

After I deleted these lines about static resource from package.xml, the error is gone.

    <types>
         <members>*</members>
         <name>StaticResource</name>
     </types>

package.xml から静的リソースに関するこれらの行を削除すると、エラーはなくなりました

Deploy source to org fails with "No authorization information found"

I had the same issue. I restarted Vscode and after that it worked.

  1. If there is an update in sfdx kindly update it to the latest version
    Restart your VS Code
  2. Then type in force:org:display -a which would display the org details such as the connection status
  3. If disconnected then reconnect it again by using SFDX:Authorize and Org

I facing the same issues. Restart VSCode seems to be the true solution.

Validate CRUD permission before SOQL/DML operation

VSCode の PMD ソース コード アナライザーから SOQL の前に CRUD 権限を確認するようにという上記の警告が表示されます。この警告は基本的に、SOQL クエリを実行する前に、現在のユーザがアクセスまたはクエリしているオブジェクトと項目にアクセスできることを確認することを示唆しています。この警告を削除するには、次のような多くのコードを追加する必要があります:-

I am getting the above warning to check CRUD permissions before SOQL from my PMD source code analyzer in VSCode. This warning basically suggests us to make sure that the current user has access to the object and fields that we're accessing or querying before executing the SOQL query. To remove this warning, we need to add a lot of code like:-

https://www.sfdcstop.com/2020/03/validate-crud-permission-before-soqldml.html

No source-backed components present in the package.

答え

LWC component's @wire target property or method threw an error during value provisioning. Original error: [error is not defined]

Check your class, you are not defining correctly a field, check the spelling of your field and if you have a getter and setter.

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

クラスを確認してください。フィールドが正しく定義されていません。フィールドのスペルとゲッターとセッターがあるかどうかを確認してください。

Running SFDX: Run Apex Tests: Faye client generated a transport:down event.

This error is typically caused by a network connectivity issue. It is possible that the Faye client is unable to establish a connection to the server, or that the connection is being blocked by a firewall or some other security measure.

このエラーは通常、ネットワーク接続の問題によって発生します。 Faye クライアントがサーバーへの接続を確立できないか、ファイアウォールまたはその他のセキュリティ対策によって接続がブロックされている可能性があります。

"SFDX: Turn On Apex Debug Log for Replay Debugger" on command palette in vscode?

vscode のコマンド パレットで "SFDX: リプレイ デバッガーの Apex デバッグ ログをオンにする" をオンにしますか?

image.png

You will need to have the Salesforce Extension Pack installed. This extension pack includes the Salesforce CLI extension, which provides the "SFDX: Turn On Apex Debug Log for Replay Debugger" command.

To install the Salesforce Extension Pack in VS Code:

  1. Open VS Code and click on the Extensions icon in the left sidebar.
  2. In the search box, type "salesforce extension pack" and press Enter.
  3. Click the Install button to install the extension pack.

Once the extension pack is installed, you should be able to use the "SFDX: Turn On Apex Debug Log for Replay Debugger" command in the Command Palette. To access the Command Palette, press Ctrl + Shift + P (on Windows) or Cmd + Shift + P (on macOS).

If you are still having trouble, you may want to try restarting VS Code after installing the extension pack. If the problem persists, you may want to try uninstalling and then reinstalling the extension pack.

Salesforce Extension Pack をインストールする必要があります。この拡張パックには、「SFDX: 再生デバッガーの Apex デバッグログをオンにする」コマンドを提供する Salesforce CLI 拡張機能が含まれています。

VS Code に Salesforce Extension Pack をインストールするには:

  1. VS Code を開き、左側のサイドバーにある [拡張機能] アイコンをクリックします。
  2. 検索ボックスに「salesforce extension Pack」と入力し、Enter キーを押します。
  3. [インストール] ボタンをクリックして拡張パックをインストールします。

拡張パックがインストールされると、コマンド パレットで「SFDX: リプレイ デバッガの Apex デバッグ ログをオンにする」コマンドを使用できるようになります。コマンド パレットにアクセスするには、Ctrl + Shift + P (Windows の場合) または Cmd + Shift + P (macOS の場合) を押します。

それでも問題が解決しない場合は、拡張パックをインストールした後に VS Code を再起動してみてください。問題が解決しない場合は、拡張パックをアンインストールしてから再インストールしてみてください。

'npm' is not recognized as internal or external command, operable program or batch file

Just add:

;C:\Program Files\nodejs\

To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.

After that, reopen your command prompt and type

npm

This should work.

https://stackoverflow.com/questions/20992723/npm-is-not-recognized-as-internal-or-external-command-operable-program-or-bat

The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in you sfdx-project.json file. Add this location to your "packageDirectorys" value, or deploy or retrieve a different file or directory.

I was getting the same error on retrieving the components from org. So i went to the actual package.xml file on my vs code ide and right click > SFDX:Retreive Source in Manifest from org and it worked. Then you can try the SFDX: Deploy this source to Org

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

組織からコンポーネントを取得するときに同じエラーが発生しました。そこで、vsコードIDEで実際のpackage.xmlファイルに移動し、右クリック> SFDX:Retreive Source in Manifest from orgをクリックすると機能しました。次に、SFDX を試すことができます: このソースを組織にデプロイします

Error authenticating with auth code due to: request to https://login.salesforce.com/services/oauth2/token failed, reason: unable to get local issuer certificate

The Salesforce CLI use NodeJS to handle the authentication between client and Salesforce server

When you use a proxy or your network not transparent the https will occur the error

You can skip the error by set bellow variable in environment on your pc NODE_TLS_REJECT_UNAUTHORIZED = 0 Note: you must restart the CMD or VSC after set variables.

Read more: Salesforce CLI Environment Variables https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_env_variables.htm

How to creating and Modifying Environment Variables on Windows https://docs.oracle.com/en/database/oracle/r-enterprise/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html

https://salesforce.stackexchange.com/questions/271375/error-running-forceauthweblogin-unable-to-get-local-issuer-certificate-whe

WARNING: In the Summer ’21 release, we'll rename or remove some of the output files that are created when you run force:apex:test:run or force:apex:test:report with the --outputdir (-d) parameter. This breaking change could impact your CI/CD scripts if they reference specific filenames. See https://sfdc.co/apex-test-updates for details\n

Thank you for reporting. Please update to the latest version of the CLI published today, v7.186.2, which has the fix for this.

Thank you. Confirm that v7.186.2 fix the issue.

https://github.com/forcedotcom/cli/issues/1909

Message: INVALID_AUTH_HEADER: INVALID_HEADER_TYPE RESPONSE {"message":"INVALID_HEADER_TYPE","errorCode":"INVALID_AUTH_HEADER"}]

I used an entirely different Trailhead Playground org, and it worked this time (even doing the same exact steps).. So, I don't know what was wrong with the original org...

まったく別の Trailhead Playground 組織を使用しましたが、今回は機能しました (まったく同じ手順を実行した場合でも)。つまり、元の組織の何が問題だったのかわかりません...

No base file for Markup://c:helloWorld when deploying source to Org

Update the all folder names under Parent helloWorld Project to match exact as parent folder name.

親 helloWorld プロジェクトの下のすべてのフォルダー名を更新して、親フォルダー名と完全に一致するようにします。

You have not authorized your Trailhead playground org via Salesforce Extensions or Salesforce Command line (CLI). Please install the development tools specified in this step and connect to the Trailhead Playground.

I had this same issue and this "15 minute step" took me like 6-8 hours of troubleshooting over two days, which I finally just finished... The solution I found after uninstalling and reinstalling extensions, sfdx update multiple times, checked PATH multiple times, and every other thing I found on the web that didn't work was so simple yet not listed anywhere in the instructions and it wasn't a VS Code issue (for me at least).

Down at the bottom of the page for the task in trailhead right by the button for +100 points is your playground listing. Hit the dots next to it to pull up more menu options and there is one for linking. I can't get a screenshot since it's now complete and I don't want to start over, but if you click it you will have to login to salesforce and like two popups will ask you to verify stuff. Verify and it will take you back to trailhead where you will hit the +100 points button again and it should pass this time.

I'm not sure if there is an oversight in their instructions or if this was covered in one of the linked articles, but it gave me such a hard time for something so simple. I definitely feel like the trailhead instructions could be a little more clear. Hope this helps others avoid the headaches and downtime I took... Now maybe I can actually learn this platform :)

私はこれと同じ問題を抱えていて、この「15分のステップ」で2日間にわたって6〜8時間のトラブルシューティングが必要でしたが、ようやく終了しました...拡張機能のアンインストールと再インストール、sfdxの更新を複数回行った後に見つけた解決策は、PATHを確認しました何度も試しましたが、ウェブで見つけた他のすべての動作しなかったものはすべて非常に単純でしたが、説明のどこにもリストされておらず、VS Code の問題ではありませんでした (少なくとも私にとっては)。

Trailhead のタスクのページの下部にある +100 ポイントのボタンのすぐ下に、プレイグラウンドのリストがあります。その横にあるドットを押すと、さらにメニュー オプションが表示されます。リンク用のオプションもあります。スクリーンショットは完成したので最初からやり直したくありませんが、クリックすると Salesforce にログインする必要があり、2 つのポップアップのように内容を確認するように求められます。確認すると、trailhead に戻り、+100 ポイント ボタンをもう一度押すと、今度は合格するはずです。

彼らの指示に見落としがあるのか​​ 、それともリンクされた記事の1つでこれがカバーされているのかはわかりませんが、非常に単純なことに苦労しました.トレイルヘッドの指示がもう少し明確になると確信しています。これが、私がかかった頭痛やダウンタイムを他の人が回避するのに役立つことを願っています...これで、実際にこのプラットフォームを学ぶことができるかもしれません:)

Command 'SFDX: Create Project with Manifest' resulted in an error .

OS がMacたっだことが影響?

error request to https://registry.npmjs.org/npm failed, reason: write EPROTO B8360300:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:c:\ws\deps\openssl\openssl\ssl\statem\extensions.c:922

unsafe legacy renegotiation disabled
プロキシサーバ経由で接続すると発生するエラーのようです。
https://community-ja.exploratory.io/t/topic/664

We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator. OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occurred during authentication.

This might sound cliche but try this; Use login.salesforce.com to login first and then try authorizing your devhub again.

ありきたりに聞こえるかもしれませんが、これを試してみてください。まず、login.salesforce.com を使用してログインし、devhub の認証を再度

Challenge "Set Up Apex Replay Debugger" Step "Authorize an Org" i get an error "Could not retrieve the username after successful auth code exchange." and the web page displays OAuth Error REST API is not enabled.

Problem solved ! the article i think is pointing to my discovery that i was trying to log on to the playground with the wrong credentials. When the login pops up:

  1. Click on " Log In with a different Username". The link may not appear at first and you may have to click on "Edit List" to get the link to appear.

  2. Do not enter the default login you entered when you initially signed up. Use the username with the animal description/animal species from when you created the new org and the password you entered for the reset , when you pasted the reset link from the email into the browser. The browser should record your new login in its cache for the user login text box for future authentications.

問題が解決しました !この記事は、私が間違った資格情報でプレイグラウンドにログオンしようとしていたという発見を指摘していると思います。ログインがポップアップ表示されたら:

  1. 「別のユーザー名でログイン」をクリックします。最初はリンクが表示されない場合があり、リンクを表示するには [リストの編集] をクリックする必要がある場合があります。

  2. 最初にサインアップしたときに入力したデフォルトのログイン情報を入力しないでください。新しい組織を作成したときの動物の説明/動物種を含むユーザー名と、メールからブラウザにリセット リンクを貼り付けたときにリセット用に入力したパスワードを使用します。ブラウザは、今後の認証に備えて、ユーザー ログイン テキスト ボックスのキャッシュに新しいログインを記録する必要があります。


その他

Sandbox またはスクラッチ組織に変更をリリースしていますか? その警告メッセージを制御する VSCode の個人ユーザー設定に設定フラグがあることを認識していますか?

First deploy the “ldsUtils” to source org and then try to deploy “contactList”
https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000C4LDeSAN

トレイルヘッド?

No MODULE named markup://c:ldsUtils found : [markup://c:contactList]

First deploy the “ldsUtils” to source org and then try to deploy “contactList”

no module named markup://c:ldsUtils found : [markup://c:accountList]

First deploy the “ldsUtils” to source org and then try to deploy “accountList”

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

You can avoid this kind of mistakes by clicking "How to Launch"(make sure omniscript is not activated) , Copy and paste from examples.

image.png

: The specified org [my_username] is not a Dev Hub. Quick Start: Explore the Easy Spaces Sample App

Please check this article.

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

This line fixed it: sfdx force:auth:web:login -d -a DevHub.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0