我对 Node,js 很陌生,"npm install" 抛出了很多错误

I am very new to Node,js and "npm install" is throwing a lot of errors

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

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>

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

附带说明一下,如果在不同的 OS 而不是虚拟机上 运行 更容易,请告诉我。

错误告诉您您没有安装 git 并且位于您的路径中。 npm 想要调用 git,因此您需要安装它并将其放在您的 PATH 中以解决此问题:

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

更新:

您可以通过转到开始菜单并搜索 "path",然后搜索 "Edit environment variables for your account" 来修改您的 PATH。添加的路径应该是 git 安装路径,最有可能是 C:\Program Files\Git\bin;

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