Pi 3에 최신 노드 버전 설치


12

설정

Jessie와 PI3가 있습니다. Wikipedia 에 따르면 ARM Cortex-A53 을 사용합니다 ARMv8-A.

이 adafruit tutorial을 사용하여 node.js를 설치할 때 v0.12여전히 베타 단계 인 node로 끝납니다 .

질문:

나는 적어도 사용하고자하는 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 최신 Raspbian ( Stretch)은 여전히을 지원 하지 않습니다armv8 .
not2qubit

답변:


11

오늘 질문의 두 번째 방법을 사용하여 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
Andi Giga

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인가 :

내 PI 및 패키지에 기록 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. 따라서 armv7파이 에는 분명히 있습니다 .

편집 : 그것은 올바른 것 같습니다 https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=140572

32 비트 모드는 운영 체제에 대한 지원이 없기 때문에 이해합니다. 누군가가 이것을 더 정확하게 설명 할 수 있다면 의견을 남겨주십시오.


데비안 arm64버전은 여기 ( debian.org/CD/netinst )이지만 아직 부팅 할 수는 없습니다.
ott--

3

nvm 사용

대체 솔루션은 nvm 을 Node의 설치 프로그램으로 사용하는 것입니다. nvmNode Version Manager의 약자이며 다음과 같은 많은 이점이 있습니다.

  • 플랫폼에 맞는 버전을 선택하고
  • 간단한 명령으로 Node를 쉽게 업데이트
  • 다른 node버전을 동시에 설치 (예 : 다른 버전의 노드로 프로그램을 확인하여 다른 설정에 대한 배포 테스트)

나는 (내가 사용하지만, 처음에 회의 동안 nvm다른 시스템에 성공적으로), 최고의 솔루션을 찾고 후해야하는 nodenpm(을 포함한 모든 사용자를위한 설치 및 접근 루트 모든 노드에 다이빙 액세스 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 설치 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

nodenpm 패키지를 전 세계적으로 설치할 수있게 해주는 모든 사용자가 새로 설치할 수 있습니다.

노드 버전을 전환 할 때마다 위의 명령을 실행해야합니다 (두려워 보일 수 있지만 node파일을 에 복사하는 /usr/local것만으로 압축 된 형식으로 작성 됨).

나는 이것이 누군가를 돕고 시간을 절약하기를 바랍니다!


참고 문헌 :

Brandon Cannaday의 RASPBERRY PINODE.JS를 설치하는 방법 ,

위 게시물의 첫 번째 의견 (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*가 운영 체제를 파괴 하는를 게시했습니다 . 와일드 카드apt-get remove/purge 를 처리하도록 설계되지 않았으므로 와 함께 와일드 카드를 사용하지 마십시오 . (일할 때 순수한 행운입니다!)

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.