2016-04-05 17 views
0

SSH経由でサーバーにソフトウェアをインストールしようとしていますが、何らかの理由でnode.jsが見つかりません。それをインストールしてください」nodejsが見つかりませんでしたし、:。私は、エラーメッセージが表示されますなぜnodejが見つかりませんか?

#!/bin/bash 

##Function Definition 
pause() { 
read -p "Press [Enter] key to exit" 
} 


cd $(dirname $0) # cd scr dir 
if [ ! "$(id -u)" = 0 ] && [ ! -f ".readwarning" ]; then 
    echo "WARNING: Ogar uses priveleged ports by default, which may" \ 
     "cause an error. Please either change the ports in the config" \ 
     "file (gameserver.ini) to two different ports above 1024, or run" \ 
     "this script as root. This warning will only be shown once, unless" \ 
     "the file \".readwarning\" is deleted" 1>&2 
    touch .readwarning 
    sleep 5 
fi 

#Check which command to execute, nodejs (debian based) or node (others) 
#This will give priority to nodejs 
command -v nodejs &>/dev/null 
if [ $? -eq 0 ]; then 
nodejs index.js 
else 
command -v nodejs &>/dev/null 

if [ $? -eq 0 ]; then 
    node index.js 
else 
    nodejs index.js echo "Couldn't find nodejs. Please install it and ensure  it is in your \$PATH" 
fi 
fi 

# Pause 
#pause 

コードで、インストールスクリプトファイルを、参照するコマンドラインに
'./public_html/server/Start-linux.sh' 

:私はタイプそれがあなたの$ PATHにあることを確認してください "。

コマンドラインに 'node -v'と入力すると、 'v4.4.2'が返されますので、明らかにそこにあります。なぜそれが見つからないと言っているのですか? $ PATHとは何ですか? nodejsが私の$パスにあることをどうやって確認するのですか?

私はSSHとnode.jsの初心者ですので、どんな助力にも感謝します。私はLinuxのcentos 64bitシステムです。

答えて

0

nodejsは、Ubuntuの一部であるamateur packet radio networksのノードnodeという古いプログラムとの競合を避けるため、一部のシステムではNode.jsバイナリの名前です。彼らは本当にそのパッケージの名前を変更し、すべての混乱を避ける必要があります。

好ましい名前はnodeで、nodejsはプラットフォーム固有のものです。私はあなたが代わりにnodeにそれらの呼び出しの名前を変更することができ、それはうまくいくと思います。

+1

や 'nodejs-遺産を設置するものである' nodejs'、へ 'node'指すようにあなたはシンボリックリンクを作ることができなければなりません'apt'経由のパッケージはDebian/Ubuntuであなたのために行います。 – mscdex

+0

@mscdexこれは本当ですが、ここでは 'nodejs'が存在しない逆のことについて話しています。 – tadman

0

あなたが二回nodejsをチェック:command -v nodejs &>/dev/null

あなたの第2のチェックはcommand -v node &>/dev/null

関連する問題