node.js - npm 从本地位置而不是从网络安装软件包?

标签 node.js npm

这个问题把我逼疯了,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/

相关文章:

javascript - 将对象数组转换为小写

windows - 如何在 Windows 上刷新 console.log 输出

javascript - 使用 Promises 从 node-sqlite 获取数据

javascript - Node.js + mongo + express MVC API : how to use controllers?

javascript - 无法解析模块 `scheduler/tracing` react native

android - 如何解决 native Android 上的此打包程序错误

node.js - NPM 搜索 : Running out of memory

javascript - Uncaught TypeError : WEBPACK_IMPORTED_MODULE_1__. 默认未定义(React、SASS、SCSS)

node.js - npm 安装权限被拒绝 (macOS)

npm - 如何定义多个 npm peerDependencies