本文翻译自:How to install an npm package from GitHub directly?

Trying to install modules from github results in: 尝试从github安装模块会导致:

ENOENT error on package.json. package.json出现ENOENT错误。

Easily reproduced using express: 使用express可以轻松复制:

npm install https://github.com/visionmedia/express throws error. npm install https://github.com/visionmedia/express引发错误。

npm install express works. npm install express工程。

Why can't I install from github? 为什么我不能从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

#1楼

参考:https://stackoom.com/question/1BT41/如何直接从GitHub安装npm软件包


#2楼

Because https://github.com/visionmedia/express is the URL of a web page and not an npm module. 因为https://github.com/visionmedia/express是网页的URL,而不是npm模块。 Use this flavor: 使用以下味道:

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

or this flavor if you need SSH: 如果您需要SSH,也可以使用以下方法:

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

#3楼

You can also do npm install visionmedia/express to install from Github 您也可以执行npm install visionmedia/express从Github安装

or 要么

npm install visionmedia/express#branch

There is also support for installing directly from a Gist, Bitbucket, Gitlab, and a number of other specialized formats. 还支持直接从Gist,Bitbucket,Gitlab和许多其他特殊格式进行安装。 Look at the npm install documentation for them all. 查看所有这些文件的npm install 文档 。


#4楼

如果未安装git,我们可以尝试

npm install --save https://github.com/Amitesh/gulp-rev-all/tarball/master

#5楼

The current top answer by Peter Lyons is not relevant with recent NPM versions. 彼得·里昂斯(Peter Lyons)当前的最高答案与最新的NPM版本无关。 For example, using the same command that was criticized in this answer is now fine. 例如,现在可以使用在此答案中批评的相同命令。

$ npm install https://github.com/visionmedia/express

If you have continued problems it might be a problem with whatever package you were using. 如果您仍然遇到问题,则可能是所使用的任何软件包都存在问题。


#6楼

还有npm install https://github.com/{USER}/{REPO}/tarball/{BRANCH}以使用其他分支。

如何直接从GitHub安装npm软件包?相关推荐

  1. conda里的r语言,使用“ conda”从github安装R软件包。

    any one can suggest how to use conda in Linux to install R package from github? Thanks! 解决方案 Accordi ...

  2. 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法

    如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...

  3. 如何列出npm用户安装的软件包?

    本文翻译自:How to list npm user-installed packages? How do I list the user-installed package ONLY in npm ...

  4. 卸载npm和安装npm_使用`npm uninstall`卸载npm软件包

    卸载npm和安装npm To uninstall a package you have previously installed locally (using npm install <pack ...

  5. 【NPM】ubuntu20.04安装npm

    ubuntu20.04安装npm sudo apt install npm ubuntu20.04安装nodejs sudo apt install nodejs 1 package is looki ...

  6. Seeduino XIAO开发板安装Arduino软件包以及USB串口驱动

    简 介: 本文对购买到的Seeed XIAO M0开发板进行了初步使用.给出了如何安装Arduino 软件包的过程.通过测试发现在Windows7中,仅仅安装了软件包还不行,需要单独安装SeeedXI ...

  7. Web前端培训知识分享:2种离线安装npm包的方法

    学习Web前端的朋友都知道JavaScript是前端绕不开的话题,也是学习的重难点.而npm是连接JavaScript的一扇大门,能解决NodeJS代码部署上的很多问题,很多人在学习时对于npm包怎么 ...

  8. Windows下安装NPM

    2019独角兽企业重金招聘Python工程师标准>>> 由于Nodejs最初在Linux开发下的历史原因,导致NPM一开始也不支持Windows环境,但是随着Nodejs成功移植到到 ...

  9. npm收录了哪些包_使用VS Code轻松找到npm软件包中的漏洞(Vuln Cost)

    Visual Studio Code可能是JavaScript开发人员使用最广泛的代码编辑器.由于开发的80%甚至90%的代码严重依赖于开源软件包,因此开发人员需要知道这些软件包的功能.例如,您是否知 ...

最新文章

  1. 【ACM】杭电OJ 1096
  2. C语言char*s 4,求讲解几道C语言的题 52 声明语句为“char s[4][15],*p1,**p2;int x,*y;”,下列语句中正...
  3. linux学习之路——ubuntu 16.04 开机开启数字小键盘解决方法
  4. sql存储过程的创建
  5. 在centos上搭建redis集群并附测试(真集群非伪集群)
  6. 厉害了!地大这位29岁博导,最大的爱好是研究火……
  7. python如何读取csv文件某几行某几列_关于python:读取.csv文件时,我似乎无法指定列dtypes...
  8. Kmeans CUDA
  9. PyQt学习--HelloWorld
  10. 注册php tp5,TP5登录注册
  11. block的名词形式_不可数名词的数量表示
  12. a4b5笔记本大小对比_【玩码】全新升级MX350独显 小米笔记本Pro 15 2020款为创造力而生...
  13. @EnableWebMvc引发的swagger-ui.html的灾难
  14. PS动感映像插件ImageMotion 1.3中文汉化版
  15. Anycubic Vyper 3D打印机串口屏改造开源项目之串口屏项目启动篇(一)
  16. 超级授权专业版 SuperSU Pro v2.68 简体中文版
  17. Neural Network, CNN 简介
  18. Unity 输出360图片
  19. Eclipse一直提示 Loading descriptor for xxx 的问题
  20. 未来几年GPT/大模型如何影响软件研发?

热门文章

  1. C++学习网站。两个 CodeProject,Codeguru
  2. Android 模拟Uart 串口通信
  3. android adb 命令源码解析
  4. oracle aul 索引,ORACLE恢復神器之ODU/AUL/DUL
  5. Hadoop架构-YARN
  6. 【Android View事件分发机制】原理
  7. iOS Core Bluetooth 基础知识
  8. RxSwift处理Error事件
  9. Flutter开发之JSON及序列化(29)
  10. elastichd安装部署