Permission denied for Git Clone when I do npm install

.npm/_cacache/tmp/git-clone/.git: permission denied
npm permission denied mac
.npm/_cacache/tmp/git-clone permission denied
npm git clone permission denied
npm install error
command failed: /usr/bin/git-clone permission denied
eacces: permission denied mac
.npm/_cacache permission denied

I have git dependencies in my package.json file. When I do sudo npm install in my react app folder, I get this error

    npm ERR! code 1
    npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master 
    https://github.com/lrojas94/react-file-base64.git /home/admin1/.npm/_cacache/tmp/git-clone-462782fb
    npm ERR! /home/admin1/.npm/_cacache/tmp/git-clone-462782fb/.git: Permission denied
    npm ERR! 

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/admin1/.npm/_logs/2017-07-18T08_58_10_906Z-debug.log
    admin1@ubuntu:~/hys_pms/ui$ nohup: appending output to ‘nohup.out’

This is my package.json

    {
      "name": "react-hys-app",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "annogenerate": "^0.8.1",
        "bootstrap": "^3.3.7",
        "cors-prefetch-middleware": "^1.0.0",
        "es6-promise": "^4.1.0",
        "express": "^4.15.3",
        "fixed-data-table": "^0.6.4",
        "flexbox-react": "^4.4.0",
        "font-awesome": "^4.7.0",
        "images-upload-middleware": "^1.1.1",
        "isomorphic-fetch": "^2.2.1",
        "jquery": "^3.2.1",
        "react": "^15.3.1",
        "react-autosuggest": "^9.0.1",
        "react-avatar-cropper": "^0.1.3",
        "react-bootstrap": "^0.30.8",
        "react-bootstrap-autosuggest": "^0.5.0",
        "react-bootstrap-date-picker": "^5.0.1",
        "react-bootstrap-table": "^3.3.1",
        "react-checkbox-list": "0.0.2",
        "react-datepicker": "^0.51.0",
        "react-datetime": "^2.8.10",
        "react-dom": "^15.4.0",
        "react-dual-listbox": "^1.1.0",
        "react-edit": "^6.3.0",
        "react-file-base64": "git+https://github.com/lrojas94/react-file-base64.git",
        "react-flexbox-grid": "^1.1.3",
        "react-grid-layout": "^0.14.6",
        "react-images-uploader": "^1.0.1",
        "react-pagify": "^2.2.0",
        "react-panelgroup": "^1.0.2",
        "react-radio-button-group": "^1.2.5",
        "react-redux": "^5.0.4",
        "react-router": "^2.7.0",
        "react-s-alert": "^1.3.0",
        "react-select": "^1.0.0-rc.5",
        "react-visibility-toggles": "^1.1.1",
        "reactabular-resizable": "^8.9.0",
        "reactabular-table": "^8.9.0",
        "recompose": "^0.23.5",
        "redux": "^3.6.0",
        "redux-devtools-extension": "^2.13.0",
        "redux-thunk": "^2.2.0",
        "redux-undo": "^1.0.0-beta9-9-1",
        "reflexbox": "^3.0.0-0",
        "schema2object": "^0.4.0",
        "searchtabular": "^1.5.0",
        "segmentize": "^0.4.1",
        "sortabular": "^1.4.0",
        "table-resolver": "^3.1.0"
      },
      "devDependencies": {
        "css-loader": "^0.28.4",
        "react-scripts": "0.9.5",
        "style-loader": "^0.18.2"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test --env=jsdom",
        "eject": "react-scripts eject"
      }
    }

This line in package.json makes the issue.

"react-file-base64": "git+https://github.com/lrojas94/react-file-base64.git"

I am struck with this issue. Kindly help.


I had this exact same error with installing chimp (not from a git repo) after I'd upgraded from NodeJS 6.10 to 8.10 (and more importantly, to NPM 5.6.0). The problem is that npm 5 handles permissions / directories very differently than npm 4.

The solution is to NEVER use sudo when running npm 5. You'll find cases of when you have to use it with npm 4, but you shouldn't need to use sudo with npm 5. If you're installing globally, this link might help you. It didn't help me.

Since I was in a docker container, I could just modify my docker file to not use sudo and then everything was fine. If you're not, I suggest you run the following as your user (not root):

cd ~
sudo rm -rf .npm
cd <wherever your package.json/node_modules is>
npm cache clean
rm -rf node_modules
npm install

Getting Permission Denied Error when Installing with NPM , /Users/juniethreatt/.npm/_cacache/tmp/git-clone-e4d5168e/.git: Permission denied npm ERR! npm ERR! A complete log of this run can be  Today i faced the same issue the problem was ~/.npm folder is messing with permission so I changed permission as sudo chown -R $(whoami) ~/.npm and it is working fine. share | improve this answer answered Dec 29 '17 at 10:34


I don't know whether your problem is solved or not. Today i faced the same issue the problem was ~/.npm folder is messing with permission so I changed permission as sudo chown -R $(whoami) ~/.npm and it is working fine.

Permission denied error when installing · Issue #2477 , /home/matt/.npm/_cacache/tmp/git-clone-d4b01914/.git: Permission denied npm ERR! npm ERR! A complete log of this run can be found in:  Sounds like a problem related to your machine for me. Also, you should never use sudo in combination with npm. I'd guess your file permissions are broken in your npm folder, you may try:


This is not a proper fix (DON'T DO IT), but it worked for me. Go to superuser mode and then do npm install with sudo.

sudo su
sudo npm install

`npm install` fails with "Permission denied" while cloning from GitHub, Does somebody know why that's failing? Or do I need some permissions to clone these repositories and missed it? npm log I used npm install npm@latest -g, it worked, but running npm install gave the same issue as before. I also tried repairing my nodejs installing. I'm wondering if I should reformat then do this: Install Git Install node generate ssh key add to gitub npm install bower -g clone repository npm install 👎


npm install private Gitlab Repo Permission Denied (publickey) in , If I use the git bash, that is installed with git on Windows, I can run the npm command and install the private repository. It only fails within  If I try to npm install a package from a git repo as root, it fails because of missing permission. This only happens as root and with a package from git. If I do this as non-root, everything works fine. For me this happens with npm v5.3.0 and v5.0.0 on different machines. At npm v4.6.1 everything is fine.


Permission denied for Git Clone when I do npm install, npm install permission denied git clone npm install error usr bin npm permission denied. I have git dependencies in my package.json file. When I do sudo npm  npm ERR! git clone git@github.com:angular/cli Permission denied (publickey). npm ERR! git clone git@github.com:angular/cli fatal: Could not read from remote repository. npm ERR! git clone git@github.com:angular/cli npm ERR! git clone git@github.com:angular/cli Please make sure you have the correct access rights


Can't read from remote git repository during npm install – CircleCI , You may encounter this error when installing npm. npm ERR! git clone ssh://git@​github.com/someuser/somerepo.git Cloning into bare What I Wanted to Do I tried: npm install -g ganache-cli sudo npm install -g ganache-cli What Happened Instead Unhandled rejection Error: Command failed: /usr/bin/git clone --depth=1 -q -b browserifyCompatible git://…