这个问题把我逼疯了,npm 数据库中有一个包,但是它有一些错误,已经在 github 中修复,我该如何使用固定版本(github 版本)?
最佳答案
编辑:
您可以直接从 GitHub 存储库安装,甚至只使用 GitHub 用户名和存储库名称:
npm install LearnBoost/socket.io
您也可以添加 <commit-ish>
,指定例如提交哈希或版本标签,如下所示:
npm install LearnBoost/socket.io#1.7.x
如果没有协议(protocol),这将被解释为 git://github.com/LearnBoost/socket.io
.您也可以在 repo 前加上 gitlab:
, gist:
或 bitbucket:
, 分别。如需更多信息,请参阅 Using git URLs as dependencies .
您可以直接从 URL 安装,例如:
npm install https://github.com/LearnBoost/socket.io/tarball/master
您可以在 Github 上任何项目页面的“下载”下找到该 URL。选择“下载为 tar.gz”链接。
或者你可以安装一个压缩包:
npm install foo.tar.gz
见 npm install(1) .
编辑:
我应该提一下,这在 package.json
中同样有效。文件。在依赖项中指定 URL 而不是版本,如下所示:
...
"dependencies": {
"foo": "http://example.com/foo.tar.gz",
"bar": "1.2.x",
...
}
关于node.js - npm 从本地位置而不是从网络安装软件包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10298775/