如何直接从GitHub安装npm包? [英] How to install an npm package from GitHub directly?

查看:402
本文介绍了如何直接从GitHub安装npm包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


package.json上的ENOENT错误。


轻松使用快递转载:

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!不是包/home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/tmp.tgz
npm ERR!错误:ENOENT,打开'/home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json'
npm ERR!如果您需要帮助,可以通过以下链接报告此日志:
npm ERR! < HTTP://github.com/isaacs/npm/issues>
npm ERR!或通过电子邮件发送至:
npm ERR! < npm-@googlegroups.com>

npm ERR!系统Linux 3.8.0-23-generic
npm ERR!命令/ usr / bin / node/ usr / bin / npminstallhttps://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!代码ENOENT
npm ERR! errno 34
npm ERR!
npm ERR!附加的日志记录细节可以在以下位置找到:
npm ERR! /home/guym/dev_env/projects_GIT/proj/snamename/npm-debug.log
npm ERR!不好的代码0


解决方案

因为 https://github.com/visionmedia/express 是网页的网址,而不是npm模块。使用这种风格:




$ b

  git + https:// git @ github.com / visionmedia / express.git 

或者如果你需要SSH的话,

  git + ssh://git@github.com/visionmedia/express.git 


Trying to install modules from github results in:

ENOENT error on package.json.

Easily reproduced using express:

npm install https://github.com/visionmedia/express throws error.

npm install express works.

Why can't I install from github?

Here is the console output:

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

解决方案

Because https://github.com/visionmedia/express is the URL of a web page and not an npm module. Use this flavor:

git+https://git@github.com/visionmedia/express.git

or this flavor if you need SSH:

git+ssh://git@github.com/visionmedia/express.git

这篇关于如何直接从GitHub安装npm包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆