当我执行npm install时,Git Clone的权限被拒绝 [英] Permission denied for Git Clone when I do npm install

查看:5603
本文介绍了当我执行npm install时,Git Clone的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的package.json文件中有git依赖项。
在我的反应应用程序文件夹中执行 sudo npm install 时,出现此错误

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’

这是我的package.json

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"
      }
    }

package.json中的这行代码引起了问题。

This line in package.json makes the issue.

我对这个问题感到震惊。请帮助。

I am struck with this issue. Kindly help.

推荐答案

我不知道您的问题是否已解决。今天我遇到了同样的问题,问题是〜/ .npm文件夹与权限混淆,因此我将权限更改为 sudo chown -R $(whoami)〜/ .npm 并且它工作正常。

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.

这篇关于当我执行npm install时,Git Clone的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆