YunoHost-Apps / kresus_ynh

Kresus (personal finance manager) for YunoHost
https://kresus.org/
GNU Affero General Public License v3.0
20 stars 20 forks source link

Install fails : "ynh_npm: command not found" #107

Closed Gofannon closed 2 years ago

Gofannon commented 2 years ago

Describe the bug

Hello there,

I tried to install kresus from the web interface and I get the error in the logs: 2021-11-14 14:39:55,928: DEBUG - /usr/share/yunohost/helpers.d/logging: line 143: ynh_npm: command not found

Context

If it can help, I tried to install the package a few months ago and has the same issue described here: https://github.com/YunoHost-Apps/kresus_ynh/issues/106

Steps to reproduce

kresus

Expected behavior

Kresus should be installed

Logs

full log: https://paste.yunohost.org/gehofasiqo.sql

Extract:

2021-11-14 14:39:55,402: INFO - [############+.......] > Installing app
2021-11-14 14:39:55,407: DEBUG - + ynh_use_nodejs
2021-11-14 14:39:55,409: DEBUG - ++ ynh_app_setting_get --app=kresus --key=nodejs_version
2021-11-14 14:39:55,410: DEBUG - ++ local _globalapp=kresus
2021-11-14 14:39:55,535: DEBUG - ++ app=kresus
2021-11-14 14:39:55,536: DEBUG - ++ [[ nodejs_version =~ (unprotected|protected|skipped)_ ]]
2021-11-14 14:39:55,538: DEBUG - ++ ynh_app_setting get kresus nodejs_version
2021-11-14 14:39:55,754: DEBUG - + nodejs_version=14
2021-11-14 14:39:55,756: DEBUG - + nodejs_path=/opt/node_n/n/versions/node/14/bin
2021-11-14 14:39:55,757: DEBUG - + shopt -s expand_aliases
2021-11-14 14:39:55,758: DEBUG - + ynh_node=/opt/node_n/n/versions/node/14/bin/node
2021-11-14 14:39:55,759: DEBUG - + alias ynh_node=/opt/node_n/n/versions/node/14/bin/node
2021-11-14 14:39:55,760: DEBUG - + ynh_npm=/opt/node_n/n/versions/node/14/bin/npm
2021-11-14 14:39:55,760: DEBUG - + alias ynh_npm=/opt/node_n/n/versions/node/14/bin/npm
2021-11-14 14:39:55,761: DEBUG - + [[ :/opt/node_n/n/versions/node/14/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: != *\:\/\o\p\t\/\n\o\d\e\_\n\/\n\/\v\e\r\s\i\o\n\s\/\n\o\d\e\/\1\4\/\b\i\n* ]]
2021-11-14 14:39:55,762: DEBUG - + node_PATH=/opt/node_n/n/versions/node/14/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2021-11-14 14:39:55,763: DEBUG - + ynh_node_load_PATH=PATH=/opt/node_n/n/versions/node/14/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2021-11-14 14:39:55,764: DEBUG - + ynh_node_load_path=PATH=/opt/node_n/n/versions/node/14/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2021-11-14 14:39:55,764: DEBUG - + cd /var/www/kresus
2021-11-14 14:39:55,765: DEBUG - + chown -R kresus: /var/www/kresus
2021-11-14 14:39:55,924: DEBUG - + ynh_exec_warn_less ynh_npm install --production --unsafe-perm
2021-11-14 14:39:55,926: DEBUG - + [[ 4 -eq 1 ]]
2021-11-14 14:39:55,927: DEBUG - + ynh_npm install --production --unsafe-perm
2021-11-14 14:39:55,928: DEBUG - /usr/share/yunohost/helpers.d/logging: line 143: ynh_npm: command not found
2021-11-14 14:39:55,930: DEBUG - + ynh_exit_properly
2021-11-14 14:39:55,932: DEBUG - + local exit_code=127
2021-11-14 14:39:55,945: DEBUG - + '[' 127 -eq 0 ']'
2021-11-14 14:39:57,474: ERROR - Impossible d'installer kresus : Une erreur est survenue dans le script d'installation de l'application
nicofrand commented 2 years ago

Hi!

Weird. What's the output of ls -la "/opt/node_n/n/versions/node/14/bin/npm"?

Gofannon commented 2 years ago

Hello,

Here you go:

root@yuno:~# ls -la "/opt/node_n/n/versions/node/14/bin/npm"
lrwxrwxrwx 1 root root 38 Oct 12 04:07 /opt/node_n/n/versions/node/14/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
root@yuno:~# which ynh_npm
root@yuno:~# whereis ynh_npm
ynh_npm:
root@yuno:~# 
tituspijean commented 2 years ago

I think that's due to the use of the helper after another one (ynh_exec_warn_less).

Can you try installing my attempt at a fix? yunohost app install https://github.com/YunoHost-Apps/kresus_ynh/tree/fix-ynh_npm -f

Edit: Tested on my end, no issues.

nicofrand commented 2 years ago

Possible regression from https://github.com/YunoHost/yunohost/pull/1358?

Gofannon commented 2 years ago

Can you try installing my attempt at a fix? yunohost app install https://github.com/YunoHost-Apps/kresus_ynh/tree/fix-ynh_npm -f

It works now but I end up with the error node-gyp rebuild. Same as here https://github.com/YunoHost-Apps/kresus_ynh/issues/71#issuecomment-633919724 (I use a kimsufi server too)

Info: Installing kresus...
Info: [+...................] > Validating installation parameters...
Info: [#+..................] > Storing installation settings...
Info: [##++................] > Finding an available port...
Info: [####+...............] > Installing app dependencies
Info: [#####+..............] > Setting up source files...
Info: [######++............] > Configuring NGINX web server...
Info: [########+...........] > Creating system user
Info: [#########+..........] > Installing nodejs
Info: [##########++........] > Installing woob
Info: [############+.......] > Installing app
Error: Unable to install kresus: An error occurred inside the app installation script
Info: The operation 'Install the 'kresus' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share 20211117-190136-app_install-kresus' to get help
Warning: Here's an extract of the logs before the crash. It might help debugging the error:
Info: DEBUG - gyp ERR! node -v v14.18.1
Info: DEBUG - gyp ERR! node-gyp -v v5.1.0
Info: DEBUG - gyp ERR! not ok
Info: DEBUG - npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@nicolo-ribaudo/chokidar-2/node_modules/chokidar/node_modules/fsevents):
Info: DEBUG - npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Info: DEBUG - npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
Info: DEBUG - npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Info: DEBUG - npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/mocha/node_modules/chokidar/node_modules/fsevents):
Info: DEBUG - npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Info: DEBUG -
Info: DEBUG - npm ERR! code ELIFECYCLE
Info: DEBUG - npm ERR! errno 1
Info: DEBUG - npm ERR! node-expat@2.4.0 install: `node-gyp rebuild`
Info: DEBUG - npm ERR! Exit status 1
Info: DEBUG - npm ERR!
Info: DEBUG - npm ERR! Failed at the node-expat@2.4.0 install script.
Info: DEBUG - npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Info: DEBUG -
Info: DEBUG - npm ERR! A complete log of this run can be found in:
Info: DEBUG - npm ERR!     /root/.npm/_logs/2021-11-17T19_06_49_041Z-debug.log
Info: DEBUG - + ynh_exit_properly
Warning: Removing the app following the installation failure...
Info: [+++.................] > Removing systemd configuration
Info: [###+++..............] > Removing associated database
Warning: cat: /etc/yunohost/psql: No such file or directory
Warning: Database  not found
Warning: cat: /etc/yunohost/psql: No such file or directory
Warning: User  not found
Info: [######++++..........] > Removing dependencies
Info: [##########+++.......] > Removing NGINX configuration
Info: [#############+++....] > Removing the dedicated system user...
Info: [####################] > Removal of kresus completed
Error: The operation 'Install the 'kresus' app' could not be completed. Please share the full log of this operation using the command 'yunohost log share XXX-kresus' to get help
root@yuno:~# 

I can try commands listed here maybe? https://github.com/YunoHost-Apps/kresus_ynh/issues/71#issuecomment-628464667

edit: add install logs https://paste.yunohost.org/tejeleziro.bash

ImaCrea commented 2 years ago

fyi (in case it may help) Tried to install with the testing branch. Installation seemed to go well but when I try to open the app I get a 502 error. Keep it up ✌️

nicofrand commented 2 years ago

Hi,

A 502 error is different. Can you provide the logs please?

ImaCrea commented 2 years ago

(sorry for not answering. I didn't have the time to get back into it.)