skip to Main Content

I am facing an issue in running environment variables in vs code terminal like npm, node(node –version) or any pip command. Node and python are installed and environement variables are set properly and commands are running in cmd but not running in vs code terminal and showing error that node is not recognized….
Tried reinstalling node, vs code still not working

2

Answers


  1. I’m sorry to hear that you are facing issues running environment variables in VS Code terminal. Here are some steps that you can try:

    1. Open VS Code and navigate to the terminal.

    2. Type echo $PATH in the terminal and press enter. This will show you the current path of your system.

    3. Check if the path contains the location of your node installation. If not, you can add it by following these steps:

      • Open the terminal and type nano ~/.bashrc and press enter.
      • Add this line at the end of the file: export PATH=$PATH:/path/to/node/bin
      • Save the file by pressing Ctrl+X, then Y, then Enter.
      • Restart VS Code and try running your commands again.
    4. If you are still facing issues, you can try adding environment variables in VS Code by following these steps:

      • Open VS Code and navigate to the terminal.
      • Click on the gear icon in the top right corner of the terminal window and select "Settings".
      • In the search bar, type "terminal.integrated.env" and press enter.
      • Click on "Edit in settings.json" and add your environment variables in this format:
        "terminal.integrated.env.windows": {
            "VAR_NAME": "VAR_VALUE"
        }
        

        Replace "windows" with your platform if you are using a different one.

    5. If none of these steps work, you can try reinstalling VS Code or resetting your settings.

    I hope this helps! Let me know if you have any other questions.

    Source:
    (1) Is there any way to set environment variables in Visual Studio Code …. Is there any way to set environment variables in Visual Studio Code?.
    (2) Terminal Profiles in Visual Studio Code. https://code.visualstudio.com/docs/terminal/profiles.
    (3) Python environments in VS Code – Visual Studio Code. https://code.visualstudio.com/docs/python/environments.

    Login or Signup to reply.
  2. Run VS Code and press Ctrl+Shift+P and type Select Default Profilethen select Command Prompt ,finally Press Ctrl+`

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search