Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alexhackney's avatar

Forge global npm package install error

Has anyone ran in to this? Fresh server 20.04 and trying to install a package globally

forge@myserver:~/node_modules$ sudo npm install -g @soketi/soketi
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects clone -b v20.10.0 ssh://[email protected]/uNetworking/uWebSockets.js.git /root/.npm/_cacache/tmp/git-clonewh4N3d --recurse-submodules --depth=1
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clonewh4N3d': Permission denied

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-09-02T14_57_31_533Z-debug-0.log
0 likes
2 replies
alexhackney's avatar
alexhackney
OP
Best Answer
Level 9

So if anyone else runs in to this. You can log in to the server as root and then install the global package. That was the only way I could get it to install. Then you can sudo run it from there.

all1.ai's avatar

In my case I am trying to install Google Lighthouse that utilizes Chrome Driver 2 different NPM packages and when I install it as root then from my laravel application I was able to make the forge user run lighthouse as root but it will call the Chrome Driver from there and it will fail as I think it tries to create a session for the forge user... so I think I really need to figure out how to give forge the access to npm globally. Been spending so many days trying to fix this. I don't know a lot about npm I might be wrong about how it works.

Please or to participate in this conversation.