【问题标题】:npm modules not installing properlynpm 模块未正确安装
【发布时间】:2016-02-27 11:35:00
【问题描述】:

我有一个几个月前创建的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 twitternpm install -g johnny-five。它在以下目录中安装了 node_modules C:\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

【问题讨论】:

  • 您是否安装了git,它在您的PATH 中吗?
  • 我有 git。哪条路?几个月前它工作的时候,我还没有 git。

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-03-27
    • 2013-09-26
    • 2013-08-26
    • 2022-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多