path: root/main/nodejs/nodejs.post-upgrade
blob: 764aa17ff342183ff1c87a1ef720ddbec07bb4df (plain) (tree)


# This file is not provided since splitting npm into a separate aport,
# so we use it to quickly detect presence of the old npm package.
if [ -f /usr/lib/node_modules/npm/configure ]; then
	pkg_ver=$(apk info -W /usr/bin/npm 2>/dev/null \
	        | sed -En 's/.*owned by npm-([^-]+).*/\1/p' \
		| grep .) || exit 0

	npm_ver=$(/usr/bin/npm --version 2>/dev/null) || exit 0

	[ "$pkg_ver" = "$npm_ver" ] && exit 0

	cat >&2 <<-EOF
	* You have an old version of the 'npm' package installed
	* (pkg version: $pkg_ver, real version: $npm_ver). The newer package
	* has a *lower* version number that now corresponds to the actual
	* version of the 'npm' program. You have to reinstall the npm package
	* (apk del npm; apk add npm) or upgrade all packages to the available
	* versions (apk upgrade -a).

exit 0