Pi 3に新しいノードバージョンをインストールする


12

セットアップ

JessieとPI3を持っています。ウィキペディアによると、それはARM Cortex-A53を使用していますARMv8-A

このadafruitチュートリアルを使用してnode.jsをインストールするv0.12と、まだベータ段階のノードになります。

質問:

私は、少なくとも、使用したいv4node.js。これをインストールして実行するにはどうすればよいですか?

失敗したアプローチ

最初

このチュートリアルでは、その方法について説明します。

wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-arm64.tar.gz
tar -xvf node-v5.0.0-linux-arm64.tar.gz
cd node-v5.0.0-linux-arm64
sudo cp -R * /usr/local/ #attention copies also readme and other not required files

v.4.0.0から テストスイートは、ARMv6、ARMv7、および新しい64ビットARMv8プロセッサで継続的にパスする必要があります。

V.5.0.0: ARMv8 64ビットバイナリ:

=>バイナリを実行できません。 -bash: /usr/local/bin/node: cannot execute binary file: Exec format error

第二

https://github.com/nodesource/distributions#installation-instructions

停止中 sudo apt-get install -y nodejs

しかし、彼らはまだGithub問題をサポートしていないと思いますarm64

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares-dev libc-ares2 libjs-node-uuid libjs-underscore libssl-dev
  libssl-doc libv8-3.14-dev libv8-3.14.5 node-abbrev node-ansi
  node-ansi-color-table node-archy node-async node-block-stream
  node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent
  node-form-data node-fstream node-fstream-ignore node-github-url-from-git
  node-glob node-graceful-fs node-gyp node-inherits node-ini
  node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-qs
  node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  node-underscore node-which
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 0 B/8,028 kB of archives.
After this operation, 38.3 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 125270 files and directories currently installed.)
Preparing to unpack .../nodejs_5.10.0-1nodesource1~jessie1_armhf.deb ...
Detected old npm client, removing...
Unpacking nodejs (5.10.0-1nodesource1~jessie1) ...

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  294.455070] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.546888] Process mmcqd/0 (pid: 52, stack limit = 0xb8cde210)

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.618619] Stack: (0xb8cdfd88 to 0xb8ce0000)

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.671359] fd80:                   00000007 b9687680 b8cdfdc4 b8cdfda0 8043c924 8043cb34

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.770515] fda0: b8cdfdc4 b8cdfdb0 8055fb5c b8cf0150 b9687400 b9687680 b8cdfdfc b8cdfdc8

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.869667] fdc0: 8043d588 8043c738 b9687624 80441c80 b8cdfdfc b8cdfde0 80441c80 b8cf0150

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  295.968821] fde0: b9687400 b8cf0258 b8cf0150 b8cdfea4 b8cdfe14 b8cdfe00 80424c54 8043d428

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.067976] fe00: b9687400 00000000 b8cdfe64 b8cdfe18 80425980 80424b5c 00000001 b8cf0034

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.167140] fe20: adec51d0 00000000 b8cb8600 8005f4f8 b8cdfe30 b8cdfe30 b8cdfe5c adec51d0

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.266294] fe40: b8cf0008 b8cf014c b9687c00 b8cf0150 00000000 adec51d0 b8cdfed4 b8cdfe68

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.365448] fe60: 80434494 804256e0 adec51d0 adec5220 b8cdfe94 b8cdfe80 802c88a0 802f97d4

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.464600] fe80: b971e580 b971e584 b8cdfeb4 00000000 b8cf0000 00000000 00000000 80443bec

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.563754] fea0: ffffffff 00ffffff b8cdfed4 b8cf0008 b9687c00 adec51d0 b8cf0000 b8cf0000

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.662907] fec0: 00000001 24590411 b8cdff24 b8cdfed8 80434fd8 804343dc 00000000 adec51d0

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.762059] fee0: b8cf8000 b8cde000 b8cdff0c b8cdfef8 802cf320 b9687400 b8cf0008 b8cf0008

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.861214] ff00: b8cf8000 b8cde000 00000000 24590411 00000001 adec51d0 b8cdff5c b8cdff28

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  296.960367] ff20: 804367c8 80434ee0 80436708 b8cf0010 00000000 b97151c0 00000000 b8cf0008

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.059522] ff40: 80436708 00000000 00000000 00000000 b8cdffac b8cdff60 80042494 80436714

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.158687] ff60: 8055fba4 00000000 b8cdff94 b8cf0008 00000000 00000000 b8cdff78 b8cdff78

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.257840] ff80: 00000000 00000000 b8cdff88 b8cdff88 b97151c0 800423ac 00000000 00000000

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.356994] ffa0: 00000000 b8cdffb0 8000f9f8 800423b8 00000000 00000000 00000000 00000000

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.456177] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  297.555354] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 55550000 55554000

Message from syslogd@raspberrypi at Apr  6 09:47:46 ...
 kernel:[  298.607208] Code: e89da818 e28400fc ebf11884 eafffff6 (e7f001f2)

関連トピック

GPIOでnode.jsをインストールする方法


現在、RPi3の最新のRaspbianStretch)には、のネイティブサポートがまだ提供されていませんarmv8
not2qubit

回答:


11

今日の質問の2番目の方法を使用してnode.jsをインストールしましたが、うまくいきました。Raspberry 3にRaspbian Jessieがいます。

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs 
sudo apt-get install -y build-essential

なぜこの方法がうまくいかなかったのかはわかりません。おそらくそれは更新されており、今より良く機能していますか?


それがあったが、私は再インストールしたときにそれがうまく機能するようになりましたかわからないv6.x
アンディギガを

4

インストールする方法

wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv7l.tar.gz
tar -xvf node-v5.0.0-linux-armv7l.tar.gz
cd node-v5.0.0-linux-armv7l
sudo cp -R * /usr/local/ #attention copies also readme and other not required files

なぜArmV7:

私のパイ&パッケージに書かれているRaspberry Pi 3 Model BによるとウィキペディアThe ARM Cortex-A53 is a microarchitecture implementing the ARMv8-A 64-bitダウンロードして、私を加鉛ARMv8 64-bit Binary

しかし、円周率はで表示されuname -a Linux raspberrypi 4.1.14-v7+ #4 SMP PREEMPT Wed Mar 23 15:30:13 UTC 2016 armv7l GNU/Linuxます。明らかにarmv7piにあります。

編集:正しいようです https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=140572

私の理解では、オペレーティングシステムのサポートが欠落しているため、32ビットモードが使用されます。誰かがこれをより正確に説明できるなら、コメントを残してください。


Debianにはarm64ここにバージョン(debian.org/CD/netinst)がありますが、まだそのバージョンを起動することができません。
-ott--

3

nvmを使用する

別の解決策は、Nodeのインストーラーとしてnvmを使用することです。nvmNode Version Managerの略で、次のような多くの利点があります。

  • プラットフォームに適したバージョンを選択する、
  • 簡単なコマンドでNodeを簡単に更新し、
  • node同時にインストールされた異なるバージョン(たとえば、異なるバージョンへの展開をテストするために異なるバージョンのノードでプログラムをチェックするため)

(私が使用していますが、私は最初に懐疑的だったがnvm、他のシステムで正常に)持っている最善の解決策を探した後、nodeおよびnpmインストールされ、(を含むすべてのユーザーのアクセスルートのすべてのノードに、ダイビングRasPiにアクセスハードウェアに必要とされます、)ディストリビューション、パッケージ、ソース、私はこの方法を試してみることにしました。そしてそれはうまくいきました!


私の手順は次のとおりです。

  1. まず、nvmをインストールする必要があります。このスクリプトはホームフォルダーまたはその他の場所から実行できますがnvm、現在のユーザーにインストールされます(私の場合はpiです。ただし、この目的のために別のスクリプトを作成しましたが、現在は不要です)。バージョン(v0.32.0)を最新のものに置き換えることができます。

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | バッシュ

    nvmへのアクセスを取得するには、端末を再度開く必要があります

  2. 次に、次の簡単なコマンドでNodeをインストールします。

    nvm install v6.6.0

    使用可能なバージョンを確認して、適切なバージョンを発行nvm ls-remoteして選択することをお勧めします。

  3. このバージョンをnodeシステムのデフォルトとして設定します。

    nvmエイリアスのデフォルトv6.6.0

  4. そして、してインストールされたバージョンをチェックnode -vし、npm -v


これで、現在のユーザー用にNode v6.6.0がインストールされました。システムのルートまたは他のユーザーはまだ利用できませんが、次のいずれかを行うために必要な場合があります。

  • シンボリックリンク(エイリアス)を作成して、システム全体で使用できるようにします。

    sudo ln -s /home/pi/.nvm/versions/node/v6.6.0/bin/node / usr / bin / node

    sudo ln -s /home/pi/.nvm/versions/node/v6.6.0/bin/npm / usr / bin / npm

  • または、システムに既にデフォルトでノードがインストールされており、上記の方法でエラーが表示された場合(私の場合のように)、この厄介な行を実行します。

    n = $(どのノード); n = $ {n%/ bin / node}; chmod -R 755 $ n / bin / *; sudo cp -r $ n / {bin、lib、share} / usr / local

新しくインストールしたものnodeは誰でも利用できるようになり、npmパッケージをグローバルにインストールできるようになります。

ノードのバージョンを切り替えたいときはいつでも上記のコマンドを実行する必要があることに注意してください(これは恐ろしいかもしれませんが、nodeファイルをにコピーするだけ/usr/localで、圧縮形式で書かれています)。

これが誰かを助け、時間を節約することを願っています!


参照:

Brandon CannadayによるNOSP.JSをRASPBERRY PIにインストールする方法、

上記の投稿の最初のコメント(RYAN PARSLEY作)、

このStackOverflowの答え

/usr/localコピーのアイデアに 付属するDigitalOceanチュートリアル

そして、インターネットとGoogleにより、私は何時間もアイデアの海から最良のソリューションを選択しようとしていました:)


0

この投稿によると、私自身の経験によると、Raspbianのプリインストールされたnode.jsバージョンはすべて古くなっています。したがって、最善のオプションは、最初に以前のノードのインストールをすべて削除してから再インストールすることです。これは、Raspbian Stretchでもうまく機能しました。

これを行う:

# Remove outdated Debian package (`node -v` ==> v4.8.2)
sudo apt-get remove nodejs nodejs-legacy nodered
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs

# Now the versions are:  nodejs: v9.3.0  npm: v5.5.1 --> npm need update
sudo npm install npm@latest -g

# Then install these useful tools: 
sudo npm install -g node-gyp
sudo npm install -g npm-check
sudo npm install -g npm-check-updates

# If needed, you can re-install node-red with:
sudo npm install -g --unsafe-perm node-red

警告

一部のばかがを投稿しsudo apt-get remove node*、OSが破壊されました。でワイルドカードを使用しないでくださいapt-get remove/purge。ワイルドカードを処理するように設計されていません。(彼らが仕事をするとき、それは純粋な運です!)

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.