function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mk450Mk450 

error in creating new project in visual studio code for LWC CLI

I have followed steps in below trailhead:
https://trailhead.salesforce.com/en/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component?trail_id=build-lightning-web-components

installed CLI and VS Code but facing issue when i am trying to create new project as below:
User-added image
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

SFDX must be in your PATH environment variable. The full path of the bin subdirectory where the SFDX executable lives. You'll likely need to relaunch your Visual Studio Code to get them to observe any changes you've made to your Windows PATH. Try closing out the VS Code or terminal and reopening a new one.

1. Verify the "Salesforce CLI" installed successfully or not
Go to → C:\Program Files\Salesforce CLI\bin → Verify sfdx.exe should be available.

2. Add this path to environment variables "Path" Go To → Windows Search → Edit environment variables for your account 

PATH value should be (depends on your OS and directory): "C:\Program Files\Salesforce CLI\bin";"C:\Users\Consultant\AppData\Local\Programs\Microsoft VS Code\bin"; 

Reference: https://salesforce.stackexchange.com/questions/163795/sfdx-is-not-recognized-as-an-internal-or-external-command

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Mk450Mk450
@khan Anas Thank you for the response.
may i know what is path vairables ? I am not able to understand from where i can find it
Khan AnasKhan Anas (Salesforce Developers) 
PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.

The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window.

Please refer to the below links which might help you further.

https://www.java.com/en/download/help/path.xml

Regards,
Khan Anas
Ajay K DubediAjay K Dubedi
Hi Mk450,

I hope you are doing well but make sure you followed these steps:

- Installed VS code with CLI 
- Open the Command Palette by pressing Ctrl+Shift+P, If you are using Windows or Cmd+Shift+P on macOS
- Type and select SFDX: Create Project
- Enter your project name
- Create a new folder or Select a folder to store the project
- Make sure after creating a project you have to authorize your org to type "SFDX: Authorize an Org" 
- You have to give credential for login, after completing this process you are able to create LWC project in VS code

For Create LWC Project you have to follow this command
- In Visual Studio code, open the Command Palette by pressing Ctrl+Shift+P on Windows or Cmd+Shift+P on macOS
- Type or Select SFDX: Create Lightning Web Component
- Press Enter to accept the default force-app/main/default/lwc
- Enter your project name
- Press Enter
- Now you can check one project will be active inside LWC folder in vs code

You can follow this link for more help:
https://www.youtube.com/watch?v=V_riFQU5iNA

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi