如何直接从GitHub安装npm软件包?

陌路散爱 提交于 2020-08-07 21:45:21

问题:

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

解决方案:

参考一: https://stackoom.com/question/1BT41/如何直接从GitHub安装npm软件包
参考二: https://oldbug.net/q/1BT41/How-to-install-an-npm-package-from-GitHub-directly
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!