0

My Server runs on Centos 8 and I installed nodejs latest (v14.17.5) and NPM (v7.21.0), both dont have a .git folder in there.

I have a very very strange issue, If I goto folder example1.com, and run npm install I get the below error,

[root@www centos]# cd /var/www/example1.com/httpdocs/
[root@www chat]#  npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/Defipoolhub/node-time.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-23T10_03_50_797Z-debug.log

However if goto a different folder, same server, and same package.json, i get no issues at all, how could it be like that,

[root@www centos]# cd /var/www/example2.com/httpdocs/
[root@www chat]#  npm install

up to date, audited 224 packages in 3s

4 packages are looking for funding
  run `npm fund` for details

4 vulnerabilities (2 low, 2 high)

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

Any idea on how to debug this issue, i did the SELinux disable and that didnt solve the problem.

mahen3d
  • 3,905
  • 12
  • 34
  • 55

1 Answers1

0

I was having a similar issue, although after the git command error it said it couldn't write or create a tmp directory. I use Ubuntu, and this worked for me (not sure if it's a clean solution, I just need it to work for a few days tbh)

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm install --unsafe-perm=true --allow-root

Hope this helps!!