Home >Web Front-end >JS Tutorial >Why Can\'t I Execute Node After Installation on Ubuntu 12.04?

Why Can\'t I Execute Node After Installation on Ubuntu 12.04?

Linda Hamilton
Linda HamiltonOriginal
2024-11-01 12:51:42332browse

Why Can't I Execute Node After Installation on Ubuntu 12.04?

NodeJS Installation Conundrum on Ubuntu 12.04

Despite following installation instructions, you may encounter issues executing node in the terminal, receiving the error: "-bash: /usr/sbin/node: No such file or directory." This occurs despite the presence of node in the /usr/sbin/ directory.

To resolve this issue, you'll need to create a symlink:

<code class="Bash">sudo ln -s `which nodejs` /usr/bin/node</code>

Alternately, if you're not using a bash-compatible shell:

<code class="Bash">sudo ln -s /usr/bin/nodejs /usr/bin/node</code>

Explanation from Installation Instructions

The naming conflict between node (Amateur Packet Radio Node Program) and nodejs necessitates the symlink to avoid conflicts.

Additional Solutions from Comments

Users have reported the following solutions:

  • sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
  • Remove and reinstall node and nodejs with sudo apt-get --purge remove node and sudo apt-get --purge remove nodejs, followed by sudo apt-get install nodejs.

The above is the detailed content of Why Can\'t I Execute Node After Installation on Ubuntu 12.04?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn