I'm currently using WSL as my development environment for a work project. When running an npm install
on a company project, I receive this error:
Command failed: /usr/bin/git clone -q <redacted url> /home/ambrose/.npm/_cacache/tmp/git-clone-393358b0
/home/ambrose/.npm/_cacache/tmp/git-clone-393358b0/.git: Permission denied
However, if I create the folder manually using mkdir
, the install proceeds until it hits another folder that it cannot create.
The IntelliJ project is on my Windows hard drive (/mnt/d/...
), if that makes any difference.
My question is: how can I avoid having to create every folder by hand during this npm install
, and what seems to be the underlying problem?
What I discovered is that WSL was incorrectly handling file locking and file access. My editor was accessing the directory at the same time as NPM, which was causing locking errors.
While I no longer use WSL on a daily basis for work, this issue seems to have been resolved with more recent updates to WSL. If the issue crops up again, the way I fixed the issue was:
I hope this helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With