npm安装vue-devtools错误:npm not found git


64x64
匿名 2017-11-01 19:36 490

使用npm安装vue-devtools工具时,出现npm没有找到git,错误提示如下:

:wampwwwvue-devtools-master>npm install
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15)
npm WARN addRemoteGit yyx990803/buble-loader resetting remote C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-0e8dc051 because of error: { Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror git://github.com/yyx990803/buble-loader.git C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-0e8dc051: undefined
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror git://github.com/yyx990803/buble-loader.git C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-0e8dc051: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15)
npm WARN addRemoteGit yyx990803/buble-loader resetting remote C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-https-github-com-yyx990803-buble-loader-git-1a84d00e because of error: { Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror https://github.com/yyx990803/... C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-https-github-com-yyx990803-buble-loader-git-1a84d00e: undefined
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror https://github.com/yyx990803/... C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-https-github-com-yyx990803-buble-loader-git-1a84d00e: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15)
npm WARN addRemoteGit yyx990803/buble-loader resetting remote C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-305e4109 because of error: { Error: not found: git
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:63:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:72:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:117:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror git@github.com:yyx990803/buble-loader.git C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-305e4109: undefined
npm ERR! git clone --template=C:UsersJserAppDataRoamingnpm-cache_git-remotes_templates --mirror git@github.com:yyx990803/buble-loader.git C:UsersJserAppDataRoamingnpm-cache_git-remotesgit-github-com-yyx990803-buble-loader-git-305e4109: undefined
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! code ENOGIT
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! Please include the following file with any support request:
npm ERR! D:wampwwwvue-devtools-masternpm-debug.log



npmvue-devtoolsmvc 回答问题

2 个解决方案


1
匿名 2017-11-01T19:38:17

vue-devtools有一些依赖包需要从git那里拉过来,而你电脑上没有安装git。

解决方法1:

使用 npm install -g git 全局装上git. 方法

解决方法2:

到github下载客户端然后用git bash运行 npm install.  


2
等待青春 2017-11-05T23:17:56

使用反射的方式修改webview允许跨域

package com.example.weinre;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.WebView;

public class MyWebView extends WebView {

    public MyWebView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }

    public MyWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyWebView(Context context) {
        super(context);
    }

    public void enablecrossdomain() {
        try {
            Field field = WebView.class.getDeclaredField("mWebViewCore");
            field.setAccessible(true);
            Object webviewcore = field.get(this);
            Method method = webviewcore.getClass().getDeclaredMethod(
                    "nativeRegisterURLSchemeAsLocal", String.class);
            method.setAccessible(true);
            method.invoke(webviewcore, "http");
            method.invoke(webviewcore, "https");
        } catch (Exception e) {
            Log.d("custom webview", "enablecrossdomain error");
            e.printStackTrace();
        }
    }

    public void enablecrossdomain41() {
        try {
            Field webviewclassic_field = WebView.class
                    .getDeclaredField("mProvider");
            webviewclassic_field.setAccessible(true);
            Object webviewclassic = webviewclassic_field.get(this);
            Field webviewcore_field = webviewclassic.getClass()
                    .getDeclaredField("mWebViewCore");
            webviewcore_field.setAccessible(true);
            Object mWebViewCore = webviewcore_field.get(webviewclassic);
            Field nativeclass_field = webviewclassic.getClass()
                    .getDeclaredField("mNativeClass");
            nativeclass_field.setAccessible(true);
            Object mNativeClass = nativeclass_field.get(webviewclassic);

            Method method = mWebViewCore.getClass().getDeclaredMethod(
                    "nativeRegisterURLSchemeAsLocal",
                    new Class[] { int.class, String.class });
            method.setAccessible(true);
            method.invoke(mWebViewCore, mNativeClass, "http");
            method.invoke(mWebViewCore, mNativeClass, "https");
        } catch (Exception e) {
            Log.d("custom webview", "enablecrossdomain error");
            e.printStackTrace();
        }
    }

}

调用设置:  

 webview.enablecrossdomain41();
settings.setAllowUniversalAccessFromFileURLs(true)  


评论