如何将非节点模块作为对Node Project thorugh NPM的依赖关系进行管理?

问题描述 投票:1回答:1

我在项目中使用Bower进行依赖管理。但是现在我想转到node和npm。但是问题是我的依赖很少是https://github.com/tkahn/Smooth-Div-Scrollhttps://github.com/swiftype/swiftype-search-jquery

这样的节点模块

如何在我的节点项目中管理所有这些依赖项。当我尝试做

"swiftype-search-jquery": "[email protected]:swiftype/swiftype-search-jquery.git",
"smooth-div-scroll": "[email protected]:tkahn/Smooth-Div-Scroll.git",

无法下载依赖项并引发错误

npm ERR! code ENOPACKAGEJSON npm ERR! package.json Non-registry package missing package.json: swiftype-search-jquery@git+ssh://[email protected]/swiftype/swiftype-search-jquery.git. npm ERR! package.json npm can't find a package.json file in your current directory.

这些依赖项在其文件夹中没有package.json。

npm bower dependency-management
1个回答
0
投票
您所缺少的只是告诉npm从中下载协议。如果您有权使用ssh密钥或oauth2令牌生成,则可以使用:

"swiftype-search-jquery": "git+https://oauth2:<your_token>[email protected]:swiftype/swiftype-search-jquery.git", "smooth-div-scroll": "git+ssh://github.com:tkahn/Smooth-Div-Scroll.git"

© www.soinside.com 2019 - 2024. All rights reserved.