You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在XAMPP-VM终端使用系统已安装的命令行工具?

How to Use Host System's Command-Line Tools in XAMPP-VM Terminal

Got it, let's break down why this is happening first—then fix it.

XAMPP-VM runs its own isolated Linux virtual machine, and the terminal you open through XAMPP is tied to that VM, not your host system's shell. That’s why tools like sass or npm you installed on your host aren’t available here: they live in a completely separate environment, and the VM doesn’t know where to find them.

Here’s how to make your host’s tools accessible without reinstalling anything:

Step 1: Locate your host’s tool paths

First, open your host system’s terminal (not XAMPP’s) and run these commands to find where sass and npm are installed:

which sass
which npm

You’ll get output like /usr/local/bin/sass or /Users/your-username/.nvm/versions/node/v18.16.0/bin/npm—save these paths.

Step 2: Find the host directory mount point in XAMPP-VM

Open your XAMPP-VM terminal and check where your host’s file system is mounted:

ls /host_mnt

You should see your host’s root directories (like usr, Users) here. XAMPP-VM typically mounts your entire host system to /host_mnt, so a host path like /usr/local/bin translates to /host_mnt/usr/local/bin in the VM.

Step 3: Temporarily add the host’s path to the VM’s PATH

Test if this works by running this command in the XAMPP-VM terminal (replace the path with the one you found in Step 1):

export PATH=$PATH:/host_mnt/usr/local/bin

Now try running sass --version or npm --version—they should work! Note: This change is temporary; it’ll reset when you close the terminal.

Step 4: Make the change permanent

To keep the host’s tools available every time you open the XAMPP-VM terminal:

  1. Open the bash configuration file in the VM:
    nano ~/.bashrc
    
  2. Add this line at the bottom (replace the path with your host’s tool directory):
    export PATH=$PATH:/host_mnt/usr/local/bin
    
  3. Save and exit: Press Ctrl+O, hit Enter, then Ctrl+X.
  4. Apply the changes immediately:
    source ~/.bashrc
    

Notes for custom tool locations

If your tools are installed in a user-specific directory (like ~/.nvm for Node.js), adjust the path to match the mounted location. For example, a host path /Users/jane/.nvm/versions/node/v18.16.0/bin becomes /host_mnt/Users/jane/.nvm/versions/node/v18.16.0/bin in the VM.

If you run into permission errors, double-check that your host directory has read access for all users (most default setups already do this).

Hope this gets you up and running with your existing tools!

内容的提问来源于stack exchange,提问作者nth-chile

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:20:25