尝试从github安装模块会导致:
package.json上的ENOENT错误。
使用Express轻松复制:
NPM install https://github.com/visionmedia/express
引发错误。
NPM install Express
可以工作。
为什么我不能从GitHub安装?
以下是控制台输出:
npm http GET https://github.com/visionmedia/express.git
npm http 200 https://github.com/visionmedia/express.git
npm ERR! not a package /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/tmp.tgz
npm ERR! Error: ENOENT, open '/home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.8.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "https://github.com/visionmedia/express.git"
npm ERR! cwd /home/guym/dev_env/projects_GIT/proj/somename
npm ERR! node -v v0.10.10
npm ERR! npm -v 1.2.25
npm ERR! path /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/guym/dev_env/projects_GIT/proj/somename/npm-debug.log
npm ERR! not ok code 0
因为https://github.com/visionmedia/express
是web页面的URL,而不是npm模块。使用以下格式:git+{url}.git
git+https://github.com/visionmedia/express.git
如果需要SSH,则可以使用此味道:
git+ssh://git@github.com/visionmedia/express.git
您还可以执行npm install visionmedia/express
从Github安装
或
npm install visionmedia/express#branch
还支持直接从Gist、Bitbucket、Gitlab和许多其他专用格式安装。请查看它们的NPM Install
文档。
如果没有安装git,我们可以试试
npm install --save https://github.com/Amitesh/gulp-rev-all/tarball/master