Install npm module - problem

Hi,

I decided to try to make my first plugin and I have little problem. Maybe because I’m beginner I cant solve it but when I want to install npm module I get this:
volumio@volumio:~$ sudo npm install onoff
[sudo] password for volumio:

> epoll@4.0.1 install /home/volumio/node_modules/epoll
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.11.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/volumio/node_modules/epoll/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/volumio/node_modules/epoll/.node-gyp/8.11.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/volumio/node_modules/epoll/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/volumio/node_modules/epoll/.node-gyp/8.11.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/volumio/node_modules/epoll/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/volumio/node_modules/epoll/.node-gyp/8.11.1"

Idk where is the problem.

Hello.
First, never SSH as root but use user Volumio instead.
Second, you have to work in your plugin folder. The file package json include the list for npm package.
You don’t need sudo from there.
Have a look at the doc and at other plugins.
:wink:

I guess, I’m still doing something wrong:

volumio@volumio:~/volumio-plugins/plugins/system_controller/test$ npm i onoff

> epoll@1.0.2 install /home/volumio/volumio-plugins/plugins/system_controller/test/node_modules/epoll
> node-gyp rebuild

gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.19.118-v7l+
gyp ERR! command "/bin/node" "/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/volumio/volumio-plugins/plugins/system_controller/test/node_modules/epoll
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! epoll@1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the epoll@1.0.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/volumio/.npm/_logs/2021-07-30T07_55_15_839Z-debug.log

you need to install some packages

sudo apt install build-essential

If package.json is correctly filled, you just need to use

npm install

https://volumio.github.io/docs/Plugin_System/Plugin_System_Overview.html

1 Like

For this particular module (on/off), you can utilised the bundled module directly from /volumio/node_modules

const { Gpio } =  require('/volumio/node_modules/onoff')

Hi there (especially @balbuze and @ashthespy),

Running into the same problem with the Volumio 3 beta (image 3.129). Loving the Buster part btw, I’m now trying to check “my” plugins for compatibility issues.

The same problem being: trying to install onoff, which triggers epoll to be rebuilt and node-gyp failing to do so.

Any tips? Also, is it ‘good practice’ to use bundled modules rather than fetch your own module per plugin? From a re-usability I’d say yes, but this also means Volumio should always pack those from a compability point of view :smiley:

Update: fun fact! All of a sudden everything works. Possibly required a reboot after installing build-essential (and a few failed attempts)

I spent quite some time pruning all the unused module, only to later find out that modules were consciously pre bundled for other closed parts of the Volumio eco system…

But considering the age of the modules bundled, probably not the best idea to depend on them :stuck_out_tongue:

PS: [PLUGIN] RotaryEncoder II - #19 by Darmur has the procedure down…

This is also good to know, thanks for clarifying. On the other hand, I can also imagine a central repo for all plugins could be considered beneficial. Oh well, there’s plenty of stuff that’s “nice to have”, I’ll focus on getting stuff up-and-running on Buster first :wink:

Hi @Saiyato,

I am using some of your plugins on Buster since long time, updating some of the node modules.

Here the script I use for installing them

sudo apt -y install build-essential
cd ~
wget http://plugins.volumio.org/plugins/volumio/armhf/system_controller/gpio-buttons/gpio-buttons.zip
mkdir ./gpio-buttons
miniunzip gpio-buttons.zip -d ./gpio-buttons
cd gpio-buttons
volumio plugin install
## when installation is finalized, press CTRL+C ##
cd /data/plugins/system_controller/gpio-buttons/
npm install --save onoff@6.0.0
sudo apt -y install build-essential
cd ~
wget http://plugins.volumio.org/plugins/volumio/armhf/system_controller/gpio_control/gpio_control.zip
mkdir ./gpio_control
miniunzip gpio_control.zip -d ./gpio_control
cd gpio_control
volumio plugin install
## when installation is finalized, press CTRL+C ##
cd /data/plugins/system_controller/gpio_control/
npm install --save onoff@6.0.0
npm install --save sleep@6.2.0
sudo apt -y install build-essential
cd ~
wget http://plugins.volumio.org/plugins/volumio/armhf/system_controller/gpio_radio_buttons/gpio_radio_buttons.zip
mkdir ./gpio_radio_buttons
miniunzip gpio_radio_buttons.zip -d ./gpio_radio_buttons
cd gpio_radio_buttons
volumio plugin install
## when installation is finalized, press CTRL+C ##
cd /data/plugins/system_controller/gpio_radio_buttons/
npm install --save onoff@6.0.0
1 Like

Hi @Darmur

Can I trouble you for some help.
I am trying to get Saiyato’s rotary encoder working.

Ive followed your method of getting the GPIO plugin to work and that does work OK. But the rotary encoder, goes through the same motions then the plugin fails to start and also upon reboot something stops volumio webpage from loading at all.

this is how I tried

sudo apt-get update

sudo apt-get -y install build-essential

cd ~

wget http://plugins.volumio.org/plugins/volumio/armhf/user_interface/rotaryencoder/rotaryencoder.zip

mkdir ./rotary

miniunzip rotaryencoder.zip -d ./rotary

cd rotary

volumio plugin install

cd /data/plugins/user_interface/rotaryencoder

npm install --save onoff@6.0.0

any ideas

Thanks

1 Like

I also had problems with that plugin, I never managed to get it working

Anyhow, with the alternative plugin I have no problems, it works fine on Buster

1 Like

Thanks for the reply,

I Have already, tried that plugin. Which as you say can be installed OK and also loads up fine.
Although I just cannot get it working correctly, It seems very flaky. the push button if set to play/pause when clicked plays sometimes but 90% of the time instanly goes straight back to pause. The rotary part just doesnt work at all in V3. Even in volumio 2 the rotary was very erratic.

Yet Saiyato’s rotary plugin works perfectly for me in V2.

2 Likes

Hi
@Darmur

Did you do anything other than you wrote above to get Rotary Encoder II working in V3

I just spent some time getting it up and running with Volumio 2, changed a few component values to fine tune the hardware debouncing. Rotary encoder II now works spot on on volumio 2.

But still nothing with the rotary in V3, button works fine though to play and pause. seems strange.

Thanks for your time

1 Like

try to reboot after setting up the plugin

Hi

ive tried that, to no avail…

in the live log every time i press save for the encoder settings, at the bottom is always Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.

so im guessing this is the issue, which is starting to get beyond me.

1 Like

I don’t know what to say, the plugin works for me on Volumio3 (Buster), besides a small issue when two encoders at the same time

Ive tried a fresh install, and still the same.

The only difference I can think, what version of Volumio 3.*** are you using. Maybe something broke along the way. I’m trying the latest 3.152

I am using 3.156

is that a typo, I dont see a 3.156 available.

edit : Enabled test mode and there it is

edit 2 : Made no difference.

Oh well, time to call it a day. Ive had enough

Thanks for your input :+1:

1 Like

@Darmur
@M1ck
Hello . get the following error when installing! And the gpio_control plugin can be seen in Volumio. but does not work

Volumio_telnet.txt (156.5 KB)