YunoHost / package_check

Shell script which check package actions: install, remove, upgrade, backup, restore…
GNU General Public License v3.0
21 stars 26 forks source link

Nodejs helper fails install script #77

Closed Krakinou closed 3 years ago

Krakinou commented 4 years ago

In the install script I have this line :

ynh_install_nodejs --nodejs_version=14

However, the install systematically failed with following log:


2020-05-14 18:15:08,345 DEBUG    yunohost.hook <lambda> - [1186.1] + ynh_handle_getopts_args '--match_string=^N_PREFIX=${N_PREFIX-.*}$' '--replace_string=N_PREFIX=${N_PREFIX-/opt/node_n}' --target_file=/opt/nod$
2020-05-14 18:15:08,345 DEBUG    yunohost.hook <lambda> - [1186.1] + set +x
2020-05-14 18:15:08,447 DEBUG    yunohost.hook <lambda> - [1186.1] + local delimit=@
2020-05-14 18:15:08,447 DEBUG    yunohost.hook <lambda> - [1186.1] + match_string='^N_PREFIX=${N_PREFIX-.*}$'
2020-05-14 18:15:08,447 DEBUG    yunohost.hook <lambda> - [1186.1] + replace_string='N_PREFIX=${N_PREFIX-/opt/node_n}'
2020-05-14 18:15:08,447 DEBUG    yunohost.hook <lambda> - [1186.1] + sed --in-place 's@^N_PREFIX=${N_PREFIX-.*}$@N_PREFIX=${N_PREFIX-/opt/node_n}@g' /opt/node_n/bin/n
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + PATH=/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + test -x /usr/bin/node_n
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + test -x /usr/bin/npm_n
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] ++ uname -m
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + uname=i686
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + [[ i686 =~ aarch64 ]]
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + [[ i686 =~ arm64 ]]
2020-05-14 18:15:08,448 DEBUG    yunohost.hook <lambda> - [1186.1] + n 14
2020-05-14 18:15:08,549 DEBUG    yunohost.hook <lambda> - [1186.1]
2020-05-14 18:15:08,549 DEBUG    yunohost.hook <lambda> - [1186.1]   ^[[36m   install^[[0m : ^[[2mnode-v14.2.0^[[22m^[[0m
2020-05-14 18:15:08,851 DEBUG    yunohost.hook <lambda> - [1186.1]
2020-05-14 18:15:08,852 DEBUG    yunohost.hook <lambda> - [1186.1]   ^[[31mError: invalid version '14.2.0'^[[0m
2020-05-14 18:15:08,852 DEBUG    yunohost.hook <lambda> - [1186.1]
2020-05-14 18:15:08,853 DEBUG    yunohost.hook <lambda> - [1186.1] + ynh_exit_properly
2020-05-14 18:15:08,853 DEBUG    yunohost.hook <lambda> - [1186.1] + local exit_code=1
2020-05-14 18:15:08,854 DEBUG    yunohost.hook <lambda> - [1186.1] + '[' 1 -eq 0 ']'
2020-05-14 18:15:08,854 DEBUG    yunohost.hook <lambda> - [1186.1] + trap '' EXIT
2020-05-14 18:15:08,855 DEBUG    yunohost.hook <lambda> - [1186.1] + set +eu```

On my test system, the script seems to work properly and I cannot reproduce the error.
ericgaspar commented 4 years ago

I have also saw a lot of this warning in package_check. @Krakinou Do you use ynh_use_nodejsin your script?

Krakinou commented 4 years ago

The install script goes like this :

ynh_install_nodejs --nodejs_version=14
ynh_use_nodejs
ynh_npm install -g coffeescript
ericgaspar commented 4 years ago

my logs: very similar to yours

kay0u commented 4 years ago

We could maybe upgrade n to the latest one? https://github.com/tj/n/releases

https://github.com/YunoHost/yunohost/blob/8ecd8fe6a334e578709120765468a5e8cb6ebd23/data/helpers.d/nodejs#L19

But I'm not sure that would solve the problem.

ericgaspar commented 4 years ago

That's what I thought. I made these modifications but it does not upgrade n in my tests :(

https://github.com/ericgaspar/yunohost/blob/ada94aec188d091b174c6d39d6d2ec420f3ce944/data/helpers.d/nodejs#L19-L20

https://github.com/ericgaspar/yunohost/blob/ada94aec188d091b174c6d39d6d2ec420f3ce944/data/helpers.d/nodejs#L127-L134