简体   繁体   中英

npm publish with private registry (git+ssh)

I'm working with private module that i created. they are stored into my private git server.

i set the dependencies for that modules successfully using :

"dependencies" :
{ 
"mymodule" : "git+ssh://git@git.myrepo.com/myproject#mybranch"
}

now i interested in publishing new release of this module without committing manually this branch. Is that possible to use something like : npm --registry git+ssh://git@git.myrepo.com/myproject#mybranch publish

in order to push my local update directly from where i used it to my branch ?

by the way the previous cmd return this error : in the next foo is the username i created with npm adduser

npm --registry "git+ssh://git@git.myrepo.com/myproject#mybranch" publish
npm WARN package.json foo@2.0.0 No README.md file found!
npm http PUT git+ssh://git@git.myrepo.com/foo
npm ERR! Error: Invalid protocol
npm ERR!     at Request.init (/usr/local/lib/node_modules/npm/node_modules/requ/main.js:302:31)
npm ERR!     at new Request (/usr/local/lib/node_modules/npm/node_modules/request/main.js:103:8)
npm ERR!     at request (/usr/local/lib/node_modules/npm/node_modules/request/main.js:956:11)
npm ERR!     at RegClient.makeRequest (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:208:13)
npm ERR!     at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:117:17)
npm ERR!     at RetryOperation.attempt (/usr/local/lib/node_modules/npm/node_modules/retry/lib/retry_operation.js:56:8)
npm ERR!     at RegClient.regRequest [as request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:114:13)
npm ERR!     at RegClient.publish (/usr/local/lib/node_modules/npm/node_module/npm-registry-client/lib/publish.js:51:8)
npm ERR!     at publish_ (/usr/local/lib/node_modules/npm/lib/publish.js:95:12)
npm ERR!     at Array.1 (/usr/local/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)

if someone know a solution to this problem or a clue , I'll really appreciate that.

Ostro

You've probably had an answer to this by now - so this is more for visitors.

After a period of headaches I've come to the conclusion the installing node modules from anything other than a registry causes more problems than it solves. I'm assuming that, like me, you're looking for an enterprise-ready workflow, rather than a quick fix.

The best thing I can suggest is to use this little gem --> https://github.com/rlidwka/sinopia

Running a local npm registry gives you much better npm integration.

The set-up I have is Sinopia backed by Git and connected using post-update hooks.

Give it a try =]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM