Zend certified PHP/Magento developer

Can’t access NPM after installing NodeJS on an Amazon Linux machine

This on an Amazon Linux machine (CentOS derived). I installed NodeJS using Yum. I verify it is there on the root account. One caveat is I cannot use NVM

[root@my-ip ~]# npm --version
8.1.0
[root@my-ip ~]# node --version
v16.13.0
[root@my-ip ~]# exit
logout

Then I go on my user account and verify that the users have access

[svc-account@my-ip ~]$ npm --version
-bash: /usr/bin/npm: Permission denied
[svc-account@my-ip ~]$ node --version
v16.13.0

So, I the user has access to NodeJS, but not NPM. Check the files:

-rwxr-xr-x 1 root root 79303064 Oct 26 11:54 /usr/bin/node
lrwxrwxrwx 1 root root       38 Nov  1 23:41 /usr/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js

So, NPM is a symlink. Now let’s check out the permissios for ../lib/node_modules/npm/bin/npm-cli.js

# ls -la ../lib/node_modules/npm/bin/npm-cli.js
-rwxr-xr-x 1 root root 54 Oct 14 05:57 ../lib/node_modules/npm/bin/npm-cli.js