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

Ubuntu 16.04LTS安装NodeJS遇“Error Executing Command, Exiting”错误求助

Hey there! Let's work through your Ubuntu 16.04 LTS issues step by step—fixing that annoying "Error Executing Command, Exiting" message and getting the latest Node.js and NPM set up properly.

Step 1: Clean Up Existing Node.js/NPM Installs

That command error is likely tied to conflicts from the outdated Node/NPM version you grabbed from the default Ubuntu repo. Let's start by wiping that clean:

  • Uninstall the old packages and remove leftover system dependencies:
    sudo apt remove --purge nodejs npm
    sudo apt autoremove
    sudo apt clean
    
  • Delete any lingering Node/NPM files that might cause conflicts later:
    sudo rm -rf /usr/local/bin/node /usr/local/bin/npm
    sudo rm -rf /usr/local/lib/node_modules
    
  • Fix any broken system packages to resolve the command execution error:
    sudo apt update
    sudo apt --fix-broken install
    

Try running your terminal commands again now—chances are that "Error Executing Command" message will be gone.

Step 2: Install the Latest Node.js and NPM

Ubuntu 16.04's default repo only hosts ancient Node versions, so we'll use NodeSource's PPA to get the latest stable release. Let's go with the current LTS version (20.x) since it's reliable for most projects:

  • Add the NodeSource PPA for Node.js 20.x:
    curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
    
  • Install Node.js (this package includes NPM automatically):
    sudo apt install -y nodejs
    
  • Verify the installation was successful:
    node --version
    npm --version
    

If you want to update NPM to its absolute latest version (sometimes the bundled one is slightly behind), run:

sudo npm install -g npm@latest
Step 3: Troubleshooting If Problems Linger

If you still hit snags:

  • Double-check that your user has proper permissions for terminal commands. Avoid using sudo for regular NPM installs unless absolutely necessary, but some system-level commands will require it.
  • Make sure /usr/local/bin (where Node/NPM binaries live) is in your system PATH:
    echo $PATH
    
    If you don't see /usr/local/bin listed, edit your ~/.bashrc file and add this line at the bottom:
    export PATH="/usr/local/bin:$PATH"
    
    Then run source ~/.bashrc to apply the change right away.

内容的提问来源于stack exchange,提问作者Hayden

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 06:52:42