CentOS 7に正しい新しいバージョンのNode.jsをインストールできないのはなぜですか?

CentOS 7に正しい新しいバージョンのNode.jsをインストールできないのはなぜですか?

注:この問題は部分的に解決されましたが、さらに注意が必要です。 OPの一番下のコメントと@Digisecの答えの一部を見てください。

CentOS 7でNode.jsを設定しようとしていますが、次のコマンドでは最新バージョンをインストールできません。 CentOS 7に最新バージョンのNode.jsをインストールするには、次のコードで何を変更する必要がありますか?

最初にnode --version結果を v0.12.7nodejs.orgv5.6.0

次に、最新バージョンのnode.jsを取得するには、次のように入力しました。

cd /tmp
curl -sL https://rpm.nodesource.com/setup | bash -

ターミナルは、古いNode.jsバージョンを削除するには、次のように入力する必要があると印刷するため、次のように入力します。

yum remove -y nodejs npm

端末でも最新バージョンのNode.jsをインストールするために、次のようなことを要求して以下のように入力しました。

yum install -y nodejs

ところで、再入力したところ、前のコマンドが以前のバージョンを再インストールしたという内容の node --version端末が再び応答しました。v0.12.7

それでは、CentOS 7システムに最新の安定版node.jsをインストールするにはどうすればよいですか?


引き続き良いことをしてください:


@Digisecの提案に従って上記のコマンドを再実行しましたが、今回はすべての出力を次のテキストに記録しました。もう少し違った順序でやり直していますが、結果は以下のようになります。

[root@localhost ~]# node --version
v0.12.7
[root@localhost ~]# cd /tmp
[root@localhost tmp]# curl -sL https://rpm.nodesource.com/setup | bash -

## Installing the NodeSource Node.js 0.10 repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_0.10/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.ePYEdVWXQH' 'https://rpm.nodesource.com/pub_0.10/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.ePYEdVWXQH'

## Cleaning up...

+ rm -f '/tmp/tmp.ePYEdVWXQH'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `yum install -y nodejs` (as root) to install Node.js 0.10 and npm.
## You may also need development tools to build native addons:
##   `yum install -y gcc-c++ make`

[root@localhost tmp]# yum remove -y nodejs npm
Loaded plugins: fastestmirror, langpacks
No Match for argument: npm
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be erased
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                             Arch                                Version                                                     Repository                                Size
====================================================================================================================================================================================
Removing:
 nodejs                              x86_64                              0.10.42-1nodesource.el7.centos                              @nodesource                               16 M

Transaction Summary
====================================================================================================================================================================================
Remove  1 Package

Installed size: 16 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                         1/1 
  Verifying  : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                         1/1 

Removed:
  nodejs.x86_64 0:0.10.42-1nodesource.el7.centos                                                                                                                                    

Complete!
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: www.gtlib.gatech.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: dallas.tx.mirror.xygenhosting.com
 * updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                             Arch                                Version                                                      Repository                               Size
====================================================================================================================================================================================
Installing:
 nodejs                              x86_64                              0.10.42-1nodesource.el7.centos                               nodesource                              4.5 M

Transaction Summary
====================================================================================================================================================================================
Install  1 Package

Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm                                                                                                             | 4.5 MB  00:00:09     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                         1/1 
  Verifying  : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                         1/1 

Installed:
  nodejs.x86_64 0:0.10.42-1nodesource.el7.centos                                                                                                                                    

Complete!
[root@localhost tmp]# node --version
v0.12.7
[root@localhost tmp]#   

それから@Digisecによると回答、次に次を試しました。しかし、結果はまだ正しいバージョンをインストールできませんでした。、次のターミナル出力に見られるように:

[root@localhost tmp]# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

## Installing the NodeSource Node.js 5.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.NEM1bxM9WB' 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.NEM1bxM9WB'

## Cleaning up...

+ rm -f '/tmp/tmp.NEM1bxM9WB'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `yum install -y nodejs` (as root) to install Node.js 5.x and npm.
## You may also need development tools to build native addons:
##   `yum install -y gcc-c++ make`

[root@localhost tmp]# yum remove -y nodejs npm
Loaded plugins: fastestmirror, langpacks
No Match for argument: npm
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be erased
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                             Arch                                Version                                                     Repository                                Size
====================================================================================================================================================================================
Removing:
 nodejs                              x86_64                              0.10.42-1nodesource.el7.centos                              @nodesource                               16 M

Transaction Summary
====================================================================================================================================================================================
Remove  1 Package

Installed size: 16 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                             1/1 
  Verifying  : nodejs-0.10.42-1nodesource.el7.centos.x86_64                                                                                                                             1/1 

Removed:
  nodejs.x86_64 0:0.10.42-1nodesource.el7.centos                                                                                                                                    

Complete!
[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: www.gtlib.gatech.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: dallas.tx.mirror.xygenhosting.com
 * updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                             Arch                                Version                                                      Repository                               Size
====================================================================================================================================================================================
Installing:
 nodejs                              x86_64                              0.10.42-1nodesource.el7.centos                               nodesource                              4.5 M

Transaction Summary
====================================================================================================================================================================================
Install  1 Package

Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
nodejs-0.10.42-1nodesource.el7 FAILED                                          
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found           ]  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/



Error downloading packages:
  nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.

[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: www.gtlib.gatech.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: dallas.tx.mirror.xygenhosting.com
 * updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                             Arch                                Version                                                      Repository                               Size
====================================================================================================================================================================================
Installing:
 nodejs                              x86_64                              0.10.42-1nodesource.el7.centos                               nodesource                              4.5 M

Transaction Summary
====================================================================================================================================================================================
Install  1 Package

Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
No Presto metadata available for nodesource  
nodejs-0.10.42-1nodesource.el7 FAILED    
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found           ]  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/



Error downloading packages:
  nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.

[root@localhost tmp]# node --version
v0.12.7
[root@localhost tmp]# 

それから訪問しました。上記のエラーログで参照されているサポート技術情報の記事しかし、私はRed Hadの顧客ではないため、記事全体にアクセスできないことがわかりました。


部分的な解決策:


@Digisecは新しいバージョンをインストールする方法を示すことで問題を部分的に解決しましたが、それでも古いバージョンを削除できないため、将来のクラッシュの危険があります。 新しいインストールがクリーンで完全になるように古いバージョンを削除するには、どのような手順を実行する必要がありますか?

私が見つけた以前のバージョンv0.12.7のtar URLはこのリンクにあります。。 @Digisec 'も読むことをお勧めします。この他のリンクはコマンドの使用を提案しますmake uninstall以前のv0.12.7を削除し、nodejsの新しいバージョンを再インストールするために端末に入力できるコマンドは5〜10個しかないようです。どのコマンドが必要ですか?

次のターミナルコマンドを使用して、CentOS 7システムでnodejs v0.12.7に関連する3つのtarファイルを見つけたようです。

[root@localhost ~]# cd /
[root@localhost /]# find . -type f -iname "*.tar"
find: ‘./run/user/1000/gvfs’: Permission denied
./opt/node-v0.12.7/deps/npm/node_modules/tar/test/dir-normalization.tar
./opt/node-v0.12.7/deps/npm/test/fixtures/gitignore-and-npmignore-2.tar
./opt/node-v0.12.7/deps/npm/test/fixtures/gitignore-and-npmignore.tar
./usr/local/lib/node_modules/npm/test/fixtures/gitignore-and-npmignore-2.tar
./usr/local/lib/node_modules/npm/test/fixtures/gitignore-and-npmignore.tar
./usr/local/lib/node_modules/npm/node_modules/tar/test/dir-normalization.tar
[root@localhost /]# 

タグ付き3つの異なるtarファイルがあり、node_modulesこれらのファイルの関係v0.12.7は不明です。

コンピュータから安全に削除v0.12.7し、関連するtarファイルをすべて削除するには、どの特定のコマンドを実行する必要がありますか?v0.12.7

ベストアンサー1

今確認しました。協会あなたはそこからこれを得ます。特に、バージョンをインストールしているか、少なくともインストールしよう0.10としていますが、インストールしているリポジトリに最新バージョンがあります。ノードv5の設定に従う必要があります。

curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

ポリスチレン:後で参照できるように、特にコマンドを実行するときは、これらのサイトを注意深く読んでください。

編集する: わかりました。追加されたようです買戻契約正しい。リポジトリを見るとパッケージがありますが、システムは間違ったバージョンを探しています。この時点で私はお勧めします。

yum clean all && yum update

キャッシュされたストレージをクリーンアップしてリモートからインポートします。

答え: 私たちが仕事を終えた後chat、ここにあなたのための正解があります。nodejs v5とてもよくインストールされました。以前に手動でコンパイルしていましたがnodejs v0.12、これはバイナリディストリビューションでは良い考えではありません。なぜならそこで終わることになるからです。

which node

返品

/usr/local/bin/node

しかし、

/usr/bin/node

正解が返されましたv5.x

この時点では、問題を解決するためのいくつかのオプションがありますが、2をお勧めします。

  • オプション1:最も簡単な方法です。を指す項目を編集し.bashrcて追加できます。を追加するのと同じくらい簡単です。これにより、毎回正しいバージョンが呼び出されますが、後でライブラリと競合しないことを保証できません。aliasnode -> /usr/bin/nodealias node="/usr/bin/node"
  • オプション2:この方法はもっと面倒ですが、それでも解決することができます。まず、yumシステムにインストールされているnodejsを使用してクリーンアップします。次に、コンパイルされたバージョンのtarballをインポートして解凍して./configure削除します。この段階では、以下を見つけることができます。オンライン簡単に。最後に、をnodejs再インストールするとyum問題が解決します。

おすすめ記事