如何在Heroku上的package.json中引用公共Bitbucket存储库作为npm模块?

7
我尝试在packages.json中使用{myrepo}: git://git@bitbucket.org/{myaccount}/{myrepo}.git。在我的本地机器上,当我键入sudo npm install(必须使用sudo)时,它可以工作并且我的存储库被克隆到node_modules。
当我将我的应用程序推送到Heroku时,会出现错误:
       npm ERR! git clone git://git@bitbucket.org/{myaccount}/{myrepo}.git Initialized empty Git repository in /app/.npm/_git-remotes/git-git-bitbucket-org-{myaccount}-{myrepo}-git-bd17f867/
       npm ERR! git clone git://git@bitbucket.org/{myaccount}/{myrepo}.git 
       npm ERR! git clone git://git@bitbucket.org/{myaccount}/{myrepo}.git fatal: Unable to look up git@bitbucket.org (Unknown host)
       npm ERR! Error: Command failed: fatal: Unable to look up git@bitbucket.org (Unknown host)
       npm ERR! 
       npm ERR!     at ChildProcess.exithandler (child_process.js:637:15)
       npm ERR!     at ChildProcess.EventEmitter.emit (events.js:98:17)
       npm ERR!     at maybeClose (child_process.js:743:16)
       npm ERR!     at Socket.<anonymous> (child_process.js:956:11)
       npm ERR!     at Socket.EventEmitter.emit (events.js:95:17)
       npm ERR!     at Pipe.close (net.js:465:12)
       npm ERR! If you need help, you may report this *entire* log,
       npm ERR! including the npm and node versions, at:
       npm ERR!     <http://github.com/npm/npm/issues>

这是公共代码库。 我做错了什么吗?
2个回答

15
尝试使用git+https://bitbucket.org/{user}/{repo}.git代替。
或者 git+ssh://git@bitbucket.org/{user}/{repo}.git 如果您想通过ssh获取它,但我不建议这样做,因为它需要身份验证。

0

@alex的答案之前对我有用,但今天我不得不更新URL以使用bitbucket:{user}/{repo} - 并确保package.json中的"name"字段正确。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接