Skip to main content 欢迎参加 3 月 5 日至 6 日在旧金山举行的 TDX AI 代理时代开发者大会,或通过 Salesforce+ 参与。立即注册

#Trailhead Challenges2,435 人正在讨论

Hands-on challenges are the “secret sauce” of Trailhead. Before searching for solutions to superbadge challenges, review the Salesforce Certification Program Agreement and Policies.

Hi !

 

Step : Set Up Your Salesforce Mobile Developer Tools for Lightning Web Components > Use Salesforce Mobile Developer Tools

 

sub step: SFDX: Preview Component Locally

after install @salesforce/lwc-dev-mobile

close and re-open visual studio

 

Android studio is open.

Device is create for simulation.

(I tested running the simulator directly before and everything is fine.)

 

Error : 

Starting SFDX: Start Local Development Server

09:33:51.221 sfdx force:lightning:lwc:start

Starting SFDX: Preview Component Locally

09:33:51.326 sfdx force:lightning:lwc:preview -p Android -t Android1 -n c/bikeCard -a browser -d c:\Salesforce\Formation\bikeCard --loglevel warn

(node:1860) Warning: Deprecated environment variable: SFDX_JSON_TO_STDOUT. Please use SF_JSON_TO_STDOUT instead.

(Use `node --trace-warnings ...` to show where the warning was created)

(node:21892) Warning: Deprecated environment variable: SFDX_JSON_TO_STDOUT. Please use SF_JSON_TO_STDOUT instead.

(Use `node --trace-warnings ...` to show where the warning was created)

» Warning: @salesforce/cli update available from 2.26.10 to 2.27.6.

» Warning: @salesforce/cli update available from 2.26.10 to 2.27.6.

» Warning: force lightning lwc start is not a sf command.

Did you mean force lightning lwc test run? [y/n]:

» Error: Run sf help force for a list of available commands.

09:34:06.773 sfdx force:lightning:lwc:start

ended with exit code 127

Error: To run this command, install the @salesforce/lwc-dev-server plugin. For more info, see [Set Up LWC Local Development](https://developer.salesforce.com/tools/vscode/en/localdev/set-up-lwc-local-dev).

> Requirements

> Checking SDK root location

> Checking Android SDK Prerequisites

> Checking Android Command Line Tools

> Checking SDK Platform Tools

> Checking SDK Platform API

> Checking SDK Platform Emulator Images

› SfError: SDK root location not found. Please set up ANDROID_SDK_ROOT or ANDROID_HOME in your environment.

› SfError: Android command line tools not found.

› SfError: No supported Android platform tools found. Minimum supported Android platform tools version is 23.

› SfError: Android SDK is missing prerequisites: Android SDK root is not set.

› SfError: No supported Android API package found. Minimum supported Android API package version is 23.

› SfError: Install at least one of these emulator images: google_apis,default,google_apis_playstore

√ Requirements (0.000 sec)

Error (1): Requirement verifications for platform %s failed.

Try this:

Please see the error messages above for details on resolving your requirement issues.

09:34:11.483 sfdx force:lightning:lwc:preview -p Android -t Android1 -n c/bikeCard -a browser -d c:\Salesforce\Formation\bikeCard --loglevel warn

ended with exit code 1

Error: Failed to start Android Emulator 'Android1'.

Android1 is the good name for the emulator. (cf screen 001)

Use Salesforce Mobile Developer Tools - error on launch local test

They say to install the @salesforce/lwc-dev-server plugin... so i do it.

 

Error : 

PS C:\Salesforce\Formation\bikeCard> sf plugins install @salesforce/lwc-dev-server

» Warning: @salesforce/cli update available from 2.26.10 to 2.27.6.

Polling for new version(s) to become available on npm... done

Successfully validated digital signature for @salesforce/lwc-dev-server.

Finished digital signature check.

Installing plugin @salesforce/lwc-dev-server@latest... failed

» Warning: @salesforce/lwc-dev-server > @oclif/config@1.18.17: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

Error: C:\Users\xxxx\AppData\Local\sf\client\2.26.10-b796e35\node_modules\yarn\bin\yarn.js add @salesforce/lwc-dev-server@latest --non-interactive

--mutex=file:C:\Users\xxxx\AppData\Local\sf\yarn.lock --preferred-cache-folder=C:\Users\xxxx\AppData\Local\sf\yarn --check-files exited with code 1

PS C:\Salesforce\Formation\bikeCard>

Well : Package no longer supported.

ok....

 

start/stop vs

launch again SFDX: Preview Component Locally

(Is it normal that it always takes so long to get started?)

 

same error than first... so i search for the other error...

 

› SfError: SDK root location not found. Please set up ANDROID_SDK_ROOT or ANDROID_HOME in your environment.

› SfError: Android command line tools not found.

› SfError: No supported Android platform tools found. Minimum supported Android platform tools version is 23.

› SfError: Android SDK is missing prerequisites: Android SDK root is not set.

› SfError: No supported Android API package found. Minimum supported Android API package version is 23.

› SfError: Install at least one of these emulator images: google_apis,default,google_apis_playstore

well.... first error missing sdk root location... This seems like an obvious error seen like that... but in fact, no...

 

However, I installed Android Studio in accordance with the previous exercise. I did not find in the trailhead where we must indicate where the path of this environment variable (ANDROID_SDK_ROOT) is and especially what value to put there. I have no idea where the android sdk is...  For ANDROID_HOME it's c:\users\<username>\.android ?

Should we install the Android SDK in addition to the Android simulator ?

 

I welcome all help!

THANKS !

Regards,

C.

0/9000

I am currently doing a trail on Developer Beginner and as I encountered a problem with the challenge because on my end I've already authorized my trailhead playground via CLI and also installed all the development tools needed as per the challenge but trailhead still shows this "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."

 

0/9000

I'm trying to complete the following Trailhead module:

Explore Core Salesforce Developer Responsibilities>Get Started with Salesforce Development>Get Ready to Develop

 

I have been able to complete all the steps up until Step 13b.

 

13. Install built-in Node.js scripts and utilities for code linting and formatting.

a. Open the Command Palette (⇧⌘P), search for View: Toggle Terminal command and select it to open the terminal in VS Code.

b. Type npm install in the terminal to complete the tooling setup.

c. Open the Command Palette (⇧⌘P), search for Developer: Reload Window command, and select it to reload the VS Code.

 

When I enter npm install, this is the message I keep receiving:

 

npm Not Recognized

Please help, as coding is not my thing and I have no idea what I'm missing. Thanks!

 

#Trailhead Challenges

0/9000

I have installed 

sf plugins install @salesforce/lwc-dev-mobile

 

But when I am running this SFDX: Preview Component Locally. It asks me to install 

sfdx plugins install @salesforce/lwc-dev-server                   

 

When I try to install lwc-dev-server, I am getting the below error. 

 

These are my npm and node versions

Node and npm version 

arpan.banerjee@arpanba-ltm4vtt ~ % node -v 

v18.20.5

arpan.banerjee@arpanba-ltm4vtt ~ % npm -v 

10.8.2 

arpan.banerjee@arpanba-ltm4vtt ~ % 

 

I have installed npm install -g node-gyp.

 

npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.npm error code 127npm error path /Users/arpan.banerjee/.local/share/sf/node_modules/fibersnpm error command failednpm error command sh -c node build.js || nodejs build.jsnpm error CXX(target) Release/obj.target/fibers/src/fibers.onpm error gyp info it worked if it ends with oknpm error gyp info using node-gyp@11.0.0npm error gyp info using node@22.11.0 | darwin | arm64npm error gyp info find Python using Python version 3.13.1 found at "/opt/homebrew/opt/python@3.13/bin/python3.13"npm error gyp info spawn /opt/homebrew/opt/python@3.13/bin/python3.13npm error gyp info spawn args [npm error gyp info spawn args '/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',npm error gyp info spawn args 'binding.gyp',npm error gyp info spawn args '-f',npm error gyp info spawn args 'make',npm error gyp info spawn args '-I',npm error gyp info spawn args '/Users/arpan.banerjee/.local/share/sf/node_modules/fibers/build/config.gypi',npm error gyp info spawn args '-I',npm error gyp info spawn args '/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/node_modules/node-gyp/addon.gypi',npm error gyp info spawn args '-I',npm error gyp info spawn args '/Users/arpan.banerjee/Library/Caches/node-gyp/22.11.0/include/node/common.gypi',npm error gyp info spawn args '-Dlibrary=shared_library',npm error gyp info spawn args '-Dvisibility=default',npm error gyp info spawn args '-Dnode_root_dir=/Users/arpan.banerjee/Library/Caches/node-gyp/22.11.0',npm error gyp info spawn args '-Dnode_gyp_dir=/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/node_modules/node-gyp',npm error gyp info spawn args '-Dnode_lib_file=/Users/arpan.banerjee/Library/Caches/node-gyp/22.11.0/<(target_arch)/node.lib',npm error gyp info spawn args '-Dmodule_root_dir=/Users/arpan.banerjee/.local/share/sf/node_modules/fibers',npm error gyp info spawn args '-Dnode_engine=v8',npm error gyp info spawn args '--depth=.',npm error gyp info spawn args '--no-parallel',npm error gyp info spawn args '--generator-output',npm error gyp info spawn args 'build',npm error gyp info spawn args '-Goutput_dir=.'npm error gyp info spawn args ]npm error gyp info spawn makenpm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]npm error ../src/fibers.cc:27:65: error: no member named 'kFinalizer' in 'v8::WeakCallbackType'npm error    27 |                 handle.SetWeak(val, WeakCallbackShim<F, P>, WeakCallbackType::kFinalizer);npm error       |                                                             ~~~~~~~~~~~~~~~~~~^npm error 1 error generated.npm error make: *** [Release/obj.target/fibers/src/fibers.o] Error 1npm error gyp ERR! build error npm error gyp ERR! stack Error: `make` failed with exit code: 2npm error gyp ERR! stack at ChildProcess.<anonymous> (/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/node_modules/node-gyp/lib/build.js:216:23)npm error gyp ERR! System Darwin 24.2.0npm error gyp ERR! command "/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/bin/node" "/Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"npm error gyp ERR! cwd /Users/arpan.banerjee/.local/share/sf/node_modules/fibersnpm error gyp ERR! node -v v22.11.0npm error gyp ERR! node-gyp -v v11.0.0npm error gyp ERR! not ok npm error node-gyp exited with code: 1npm error Please make sure you are using a supported platform and node version. If younpm error would like to compile fibers on this machine please make sure you have setup yournpm error build environment--npm error Windows + OS X instructions here: https://github.com/nodejs/node-gypnpm error Ubuntu users please run: `sudo apt-get install g++ build-essential`npm error RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` npm error Alpine users please run: `sudo apk add python make g++`npm error sh: nodejs: command not foundnpm error A complete log of this run can be found in: /Users/arpan.banerjee/.npm/_logs/2025-01-03T10_52_27_535Z-debug-0.log@salesforce/cli: Installing plugin @salesforce/lwc-dev-server@latest... failed ›   Error: /Users/arpan.banerjee/.local/share/sf/client/2.70.7-b4edef3/node_modules/npm/bin/npm-cli.js install  ›   @salesforce/lwc-dev-server@latest --omit dev --no-audit --loglevel=notice --no-fund exited with code 127 ›   Try this: Run with DEBUG=@oclif/plugin-plugins* to see debug output.

Attaching the screenshot of the error-

 

Error while running  SFDX: Preview Component Locally.

 

 

#Trailhead Challenges

8 个回答
  1. 1月4日 05:46

    Hi ,

     

    I was getting installation issues on my Mac as well. I finally figured the solution. SFDX CLI needs to be installed via NPM, and not directly with the installer. Also it is only Supported with Node V18. What I effectively did was:

    1. Remove SF CLI: Link
    2. Used NVM to install and use Node 18( As I already had a different version installed)
    3. Installed SFDX CLI via NPM: Link

    I tried installing the plugin and it installed successfully.

     

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

0/9000