【问题标题】:I am very new to Node,js and "npm install" is throwing a lot of errors我对 Node、js 很陌生,“npm install”抛出了很多错误
【发布时间】:2016-03-16 20:36:37
【问题描述】:

我正在尝试使用https://github.com/avatarkava/beavisbot-dubtrack-fm/tree/f302f4a278ca308027c05f52c3c0dd30f72a2e60。正如我在自述文件中看到的那样,我使用 Windows PowerShell 在根文件夹中运行了NPM install,它返回了以下错误:

PS C:\Users\Ryan> cd desktop
PS C:\Users\Ryan\desktop> cd plug
PS C:\Users\Ryan\desktop\plug> npm install
npm WARN package.json BeavisBot@2.0.0 No license field.
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:63:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:72:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  git://github.com/jpravetz/node-datatable.git resetting remote C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jpravetz-node-datatable-git-1942cdb7 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:63:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:72:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  git://github.com/AvatarKava/cleverbot-node.git resetting remote C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-AvatarKava-cleverbot-node-git-2c5ade26 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:63:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:72:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  git://github.com/plugCubed/plugAPI.git resetting remote C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-plugCubed-plugAPI-git-570cfe8a because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/plugCubed/plugAPI.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-plugCubed-plugAPI-git-570cfe8a: undefined
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/plugCubed/plugAPI.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-plugCubed-plugAPI-git-570cfe8a: undefined
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/jpravetz/node-datatable.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jpravetz-node-datatable-git-1942cdb7: undefined
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/jpravetz/node-datatable.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jpravetz-node-datatable-git-1942cdb7: undefined
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/AvatarKava/cleverbot-node.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-AvatarKava-cleverbot-node-git-2c5ade26: undefined
npm ERR! git clone --template=C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/AvatarKava/cleverbot-node.git C:\Users\Ryan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-AvatarKava-cleverbot-node-git-2c5ade26: undefined
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
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!     C:\Users\Ryan\desktop\plug\npm-debug.log
PS C:\Users\Ryan\desktop\plug>

我曾尝试运行npm install 几次以查看它是否是一次性错误,但我每次都得到相同的结果。

附带说明,如果这更容易在不同的操作系统而不是虚拟机上运行,​​请告诉我。

【问题讨论】:

    标签: node.js powershell npm npm-install


    【解决方案1】:

    错误是告诉您您没有安装git 并位于您的路径中。 npm 想调用git,所以你需要安装它并将它放在你的 PATH 中来解决这个问题:

    https://git-scm.com/download/win

    更新:

    您可以通过转到开始菜单并搜索“路径”,然后搜索“为您的帐户编辑环境变量”来修改您的 PATH。添加的路径应该是git安装路径,最有可能是C:\Program Files\Git\bin;

    如果您的路径不同,请尝试在目录资源管理器中查找。

    【讨论】:

    • 我安装了 git,但我不知道如何更改路径。我试图使用这个答案stackoverflow.com/a/26620861/5853128,我能够一直沿着路径到达C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\ ,但是cmd\git.exe 找不到
    • 请注意,您需要重新启动 PowerShell 才能使环境更改生效。您还可以在进程环境 ($env:PATH += ';C:\Program Files\Git\bin') 中修改 PATH 变量,但该修改是不稳定的,并且会在您关闭 PowerShell 控制台窗口时消失。
    • 完美的@pholtz 成功了!现在我只需要下载python解释器就可以了!除非这意味着与解释器 (Error: Can't find Python executable "python", you can set the PYTHON env variable.) 不同的东西
    猜你喜欢
    • 2022-01-06
    • 2015-07-23
    • 2014-11-07
    • 2018-01-17
    • 2016-02-08
    • 1970-01-01
    • 2021-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多