Module version mismatch when running sudo resin local configure

Hi all,

This is my first post in this forum and I would like to know if you encountered this case. Before describing my issue, let me introduce my work environment.

I would like to install ResinOS on RPI3 and for this I installed resin-cli on Lubuntu 18.04 and I run these steps:

1- Remove old NodeJS installation/trace:
sudo apt-get purge nodejs
sudo apt-get remove nodejs
sudo apt-get autoremove

2- Install pre-requirement:
sudo apt-get install build-essential libssl-dev

3- Install nvm:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

4- Reload profile (or log off then log on):
source ~/.profile

5- Install and use node 6.14.2 :
nvm install 6.14.2
nvm use 6.14.2
nvm alias default 6.14.2

6- Download resinOS:
cd ~/Downloads
wget https://files.resin.io/resinos/raspberrypi3/2.12.7%2Brev1.dev/image/resin.img.zip

7- Workaround for the error /usr/bin/env: ‘node’: No such file or directory when running <sudo resin local configure ~/Downloads/resin.img> :

sudo ln -s $(which node) /usr/bin/node

8- Install Resin-cli:
npm install --global --production resin-cli

9- Update resinOS image:
sudo resin local configure ~/Downloads/resin.img

At this step I got the error message:

Module version mismatch. Expected 48, got 57

So do you know how to fix it or at least how to identify the faulty module

for your convenience, these are the information on the Ubuntu:

~/.nvm$ uname -a
Linux vm 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

~/.nvm$ node -v
v6.14.2

~/.nvm$ npm -v
3.10.10

~/.nvm$ nvm version
v6.14.2

~$ which node
HOME/[user]/.nvm/versions/node/v6.14.2/bin/node

~$ /usr/bin/env | grep "node"
NVM_BIN=HOME/[user]/.nvm/versions/node/v6.14.2/bin
PATH=HOME/[user]/.nvm/versions/node/v6.14.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Regards

Hi,
The issue is probably that the installed npm modules don’t become available to the sudo user. I was able to reproduce and the following fixed the issue for me:

n=$(which node); \
n=${n%/bin/node}; \
chmod -R 755 $n/bin/*; \
sudo cp -r $n/{bin,lib,share} /usr/local

See: https://stackoverflow.com/questions/21215059/cant-use-nvm-from-root-or-sudo/29903645#29903645

Here is also the respective nvm issue for sudo operations:


Thank you it worked and I was able to deploy resin on my RPI3.

Unfortunately, I can’t find the option to close this topic.

You should be able to click the image on the reply that resolved your issue and then click image .
If for any reason this doesn’t show up for you, then nevermind :slight_smile: