Search code examples
node.jslinuxnpmopensuse

Error message npm-default is unavailable


I updated the npm in opensuse 42.2 leap and after that, I got this error:

npm-default is unavailable.

I look inside the npm:

#!/bin/sh

PROG=$(basename $0)
PROG_VERSION=${NODE_VERSION:--default}

if [ ! -x /usr/bin/${PROG}${PROG_VERSION} ]; then
    echo "${PROG}${PROG_VERSION} is unavailable."
    exit 127
fi
exec /usr/bin/${PROG}${PROG_VERSION} "$@"

I figured out that the NODE_VERSION is not defined, so I added it to env:

export NODE_VERSION=8

Then I got this msg:

npm8 is unavailable.

But:

ls -la /usr/bin/npm8:

lrwxrwxrwx 1 root root 41 okt 17 14.46 /usr/bin/npm8 -> ../lib64/node_modules/npm8/bin/npm-cli.js

Finally I tried these:

npm8:

bash: /usr/bin/npm8: Permission denied

sudo npm8:

sudo: npm8: command not found

I think the latest npm update has some problem, but I don't know how can I fix it. Did anybody else meet this problem?

I've already tried reinstall the packages.


Solution

  • My colleague figured out the problem; I had to add an executable right for /usr/lib64/node_modules/npm8/npm-cli.js file.