0

我有一个nodejs几个月前创建的项目并放弃了它。当时它工作正常。

现在我需要那个项目,但是 nodejs 模块没有正确安装(如我所料)。说些什么

我正在使用以下模块

var Twitter = require('twitter');
var five = require("johnny-five");

我首先尝试npm install johnny-five在我的工作目录(本地)中安装,它给了我这个错误

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  jacobrosenthal/node-pre-gyp-github#production resetting remote C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-00f1b2658a8ab0261b1b6e8aa994ae37 because of error: { [Error: not found: git] code: 'ENOGIT' }

所以我运行npm install -g twitter& npm install -g johnny-five。它在以下目录中安装了 node_modulesC:\Users\skyse\AppData\Roaming\npm\node_modules

但是当我运行我的程序node execute.js时,它给了我缺少模块的错误

我检查了我正在使用的模块是否已安装

我收到request模块错误,所以我安装了它,然后它给了我错误serialport,现在这个模块没有安装

我尝试重新安装(手动删除 johnny-5 模块文件夹后)

它确实安装但也给出了一堆警告和错误

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  jacobrosenthal/node-pre-gyp-github#production resetting remote C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-00f1b2658a8ab0261b1b6e8aa994ae37 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-00f1b2658a8ab0261b1b6e8aa994ae37: undefined
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-00f1b2658a8ab0261b1b6e8aa994ae37: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  jacobrosenthal/node-pre-gyp-github#production resetting remote C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-jacobrosenthal-node-pre-gyp-github-git-production-1e8dd7eab6415a0b31fc9e88e23213e9 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-jacobrosenthal-node-pre-gyp-github-git-production-1e8dd7eab6415a0b31fc9e88e23213e9: undefined
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-jacobrosenthal-node-pre-gyp-github-git-production-1e8dd7eab6415a0b31fc9e88e23213e9: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  jacobrosenthal/node-pre-gyp-github#production resetting remote C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-d32d5d69965585ea64fc38a162bde390 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-d32d5d69965585ea64fc38a162bde390: undefined
npm ERR! git clone --template=C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:jacobrosenthal/node-pre-gyp-github.git C:\Users\skyse\AppData\Roaming\npm-cache\_git-remotes\git-github-com-jacobrosenthal-node-pre-gyp-github-git-production-d32d5d69965585ea64fc38a162bde390: undefined
npm WARN install Couldn't install optional dependency: not found: git
C:\Users\skyse\AppData\Roaming\npm
└─┬ johnny-five@0.9.11
  ├─┬ array-includes@3.0.1
  │ ├─┬ define-properties@1.1.2
  │ │ ├── foreach@2.0.5
  │ │ └── object-keys@1.0.9
  │ └─┬ es-abstract@1.4.3
  │   ├─┬ es-to-primitive@1.0.0
  │   │ ├── is-date-object@1.0.1
  │   │ └── is-symbol@1.0.1
  │   ├── function-bind@1.0.2
  │   ├── is-callable@1.1.0
  │   └── is-regex@1.0.3
  ├─┬ chalk@1.1.1
  │ ├── ansi-styles@2.1.0
  │ ├── escape-string-regexp@1.0.3
  │ ├─┬ has-ansi@2.0.0
  │ │ └── ansi-regex@2.0.0
  │ ├── strip-ansi@3.0.0
  │ └── supports-color@2.0.0
  ├── color-convert@0.5.3
  ├── descriptor@0.1.0
  ├── ease-component@1.0.0
  ├── es6-shim@0.33.13
  ├── lodash@3.10.1
  ├── nanotimer@0.3.10
  └── temporal@0.5.0
4

1 回答 1

0

node_modules/在我的工作目录的父目录中。它包含导致问题的旧文件和丢失文件。我删除了它,现在一切正常

于 2015-11-25T10:46:29.290 回答