npm模块安装不正确

时间:2015-11-24 20:56:00

标签: node.js npm node-modules npm-install

我有一个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。它在以下目录C:\Users\skyse\AppData\Roaming\npm\node_modules

中安装了node_modules

但是当我运行我的程序node execute.js时,它会让我错过模块

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

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

  

我尝试重新安装(手动删除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 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

1 个答案:

答案 0 :(得分:0)

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