rstudio / shiny-server

Host Shiny applications over the web.
https://rstudio.com/shiny/server
Other
712 stars 290 forks source link

Building R shiny server from source on ARM gives - ./bin/npm: 4: exec: ./bin/../ext/node/bin/node: Exec format error #477

Closed bapoorva closed 3 years ago

bapoorva commented 3 years ago

Hi,

Im using Ubuntu 20.04 with ARM64 on amazon AWS platform to host a shiny app. I couldn't install Shiny server directly using the pre-built installers. It gave me this error

>sudo gdebi shiny-server-1.5.16.958-amd64.deb
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
This package is uninstallable
Dependency is not satisfiable: libc6 (>= 2.7)

So i tried to install it from the source and ended up getting this error

(cd .. && ./bin/npm install)
./bin/npm: 4: exec: ./bin/../ext/node/bin/node: Exec format error

I followed the discussion in #347 and here and tried both

RUN sed -i '8s/.*/NODE_SHA256=abef7d431d6d0e067fe5797d4fe44039a5577f01ed9e40d7a3496cbb22502f55/' shiny-server/external/node/install-node.sh
RUN sed -i 's/linux-x64.tar.xz/linux-armv7l.tar.xz/' /shiny-server/external/node/install-node.sh

and

sed -i '8s/.*/NODE_SHA256=7a2bb6e37615fa45926ac0ad4e5ecda4a98e2956e468dedc337117bfbae0ac68/' ../external/node/install-node.sh
sed -i 's/linux-x64.tar.xz/linux-armv7l.tar.xz/' ../external/node/install-node.sh

and got this error

Downloading Node v12.20.0 from https://github.com/jcheng5/node-centos6/releases/download/v12.20.0/node-v12.20.0-linux-arm64.tar.xz
--2021-02-01 21:40:10--  https://github.com/jcheng5/node-centos6/releases/download/v12.20.0/node-v12.20.0-linux-arm64.tar.xz
Resolving github.com (github.com)... 140.82.114.4
Connecting to github.com (github.com)|140.82.114.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-02-01 21:40:10 ERROR 404: Not Found.

So i figured the SHA checksums here were outdated and i'd to use the ones here. Edited the install-node.sh file and changed download link and then got checksum failed.

>(cd .. && external/node/install-node.sh)
Downloading Node v12.20.0 from https://nodejs.org/dist/v12.20.0/node-v12.20.0-linux-arm64.tar.xz
--2021-02-01 21:41:20--  https://nodejs.org/dist/v12.20.0/node-v12.20.0-linux-arm64.tar.xz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:162e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14038888 (13M) [application/x-xz]
Saving to: ‘/tmp/node-v12.20.0-linux-arm64.tar.xz’

/tmp/node-v12.20.0-linux-ar 100%[==========================================>]  13.39M  --.-KB/s    in 0.1s    

2021-02-01 21:41:21 (90.9 MB/s) - ‘/tmp/node-v12.20.0-linux-arm64.tar.xz’ saved [14038888/14038888]

Checksum failed!

Running out of ways to get this to work now. Any ideas how to solve this ?

Thanks

bapoorva commented 3 years ago

I think I figured out what the problem is. The default nvm was set to 12.20.0 and the SHA checksum was for 12.20.1. So this is what I did. I followed the instructions here to lock the project's node version. Edited the .nvmrc file to the right node version (in my case 12.20.1) and then edited the ../external/node/install-node.sh script to use the right SHA256 from here by giving

NODE_SHA256=3c1dff2a7070214fa3947f8b7331c592e2d7c7347693da927b56cfd51ed70917
local NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/${NODE_FILENAME}"

This fixed the issue for me