简体   繁体   English

从git url添加一个模块

[英]adding a module from git url

i have a module.which is on private repo.i have git url of it as well https url.but how to add it as dependency.my package.json is 我有一个module.which是在私人repo.i有git url的它以及https url.but如何添加它作为dependency.my package.json是

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "3.4.0",
    "jade": "*",
   "passport-strategy" : "ssh://git@bitbucket.org/RiteshM/passport-strategy.git"
  }
}

its giving me error on npm install 它在npm安装上给我错误

npm http GET https://registry.npmjs.org/passport-strategy
npm http 304 https://registry.npmjs.org/passport-strategy
npm ERR! Error: No compatible version found: passport-strategy@'ssh://git@bitbucket.org/RiteshM/passport-strategy.git'
npm ERR! Valid install targets:
npm ERR! ["1.0.0"]
npm ERR!     at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/cache.js:638:10
npm ERR!     at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR!     at Object.oncomplete (fs.js:107:15)
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.5.0-40-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/ritesh/projects/passport-topcoder/examples/signin
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ritesh/projects/passport-topcoder/examples/signin/npm-debug.log
npm ERR! not ok code 0

isn't there is any method by which we can install a module without registering it on npm registry ??Please guideline. 是不是有任何方法可以安装模块而无需在npm注册表上注册?请指导。

Your Git URL is of incorrect format. 您的Git网址格式不正确。 In the npm documentation , it is stated that Git URLs must be of one of these formats: npm文档中 ,声明Git URL必须是以下格式之一:

git://github.com/user/project.git#commit-ish
git+ssh://user@hostname:project.git#commit-ish
git+ssh://user@hostname/project.git#commit-ish
git+http://user@hostname/project/blah.git#commit-ish
git+https://user@hostname/project/blah.git#commit-ish

So your package.json should look more like this: 所以你的package.json看起来应该更像这样:

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "3.4.0",
    "jade": "*",
    "passport-strategy": "git+ssh://git@bitbucket.org/RiteshM/passport-strategy.git"
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从git url依赖项找不到模块 - Module Not Found from git url dependency Node.js + Git:如何避免将模块依赖项添加到存储库 - Node.js + Git: How To Avoid Adding Module Dependencies to Repository 将私有git url用于npm模块时,如何配置使用方应用程序以仅使用模块dist文件夹中的文件? - When using a private git url for an npm module, how can I configure the consuming application to only use files from the module's dist folder? Beanstalk的NPM自定义URL模块 - NPM Custom URL Module From Beanstalk 从GitHub获取npm模块会带来“ .git”文件夹 - Fetching npm module from GitHub brings “.git” folder 无法从CirlcleCI中的git存储库安装节点模块 - Unable to install node module from git repository in CirlcleCI 在 simple-git 中移动和重新添加远程 URL 后设置上游分支跟踪 - set upstream branch tracking after moving and re-adding remote URL in simple-git npm从私有注册表安装回退到git存储库URL - npm install from private registry with fallback to a git repository URL 从NodeJS的REQUEST模块获取当前URL - Getting current URL from NodeJS's REQUEST module 如何从 nodejs 请求模块获取重定向的 url? - How do I get the redirected url from the nodejs request module?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM