Install package
# guix package -i node
Enable user handle global packages (npm)
$ mkdir /home/<user>/.vnode
$ npm config set prefix "/home/<user>/.vnode"
Append to $PATH bins (npm)
$ echo PATH=/home/<user>/.vnode/bin:$PATH
Install npm
$ npm install npm
Now put on /home/<user>/.vnode/lib/node_modules/.hooks/preinstall
#/run/current-system/profile/bin/bash
pkg_path=$PWD
function patch_shebang() {
file=$1
python_bin=`type -p python`
python_bin=`type -p ruby`
env_bin=`type -p env`
bash_bin=`type -p bash`
if [ -n "$env_bin" ]; then
sed -i -uE "s|^#!.+/env|#!${env_bin}|" $file
elif [ -n "$bash_bin" ]; then
sed -i -uE "s|^#!.+/bash|#!${bash_bin}|" $file
elif [ -n "$python_bin" ]; then
sed -i -uE "s|^#!.+/bash|#!${python_bin}|" $file
elif [ -n "$ruby_bin" ]; then
sed -i -uE "s|^#!.+/bash|#!${ruby_bin}|" $file
fi
}
files=`find $pkg_path -type f -exec grep -lE '^#!(.+ )' {} \;`
for file in $files; do
patch_shebang $file
done
Allow run
$ chmod a+rx /home/<user>/.vnode/node_modules/.hooks/preinstall
If everything it's ok, now run npm install -g and see this work's.
For local packages just copy the hook myproject/node_modules/.hooks/preinstall.