Npm听起来像是一个在组织中使用的很棒的平台,很好奇是否可以像Nexus/Maven那样使用私人回购。谷歌上什么都没有出现:(
当前回答
我可能有点晚了,但这两个中的任何一个都可能对你有用:
http://www.jfrog.com/confluence/display/RTF/Npm+Repositories https://github.com/krakenjs/kappa
其他回答
我不认为有一个简单的方法来做到这一点。
看看npm文档就知道,这是可能的:
Can I run my own private registry? Yes! The easiest way is to replicate the couch database, and use the same (or similar) design doc to implement the APIs. If you set up continuous replication from the official CouchDB, and then set your internal CouchDB as the registry config, then you'll be able to read any published packages, in addition to your private ones, and by default will only publish internally. If you then want to publish a package for the whole world to see, you can simply override the --registry config for that command.
在clock博客中也有一个关于如何创建私有npm存储库的优秀教程。
编辑(2017-02-26):
不是什么新鲜事,但是现在有付费计划在npm上托管私有包。
这些年来,通过建立在npm之上的巨大前端生态系统,npm也成为了许多非node .js公司的一个因素。如果你的公司已经在内部运行Sonatype Nexus来托管Java项目,你也可以用它来托管内部npm包。
其他选项包括JFrog Artifactory和Inedo ProGet,但我还没有用过。
我想在列表中添加AWS Code Artifact服务,如果您的组织也在使用AWS git回购,看起来是一个不错的方法。
https://aws.amazon.com/blogs/devops/publishing-private-npm-packages-aws-codeartifact/
如果你更喜欢分散的方法,你也可以使用Aragon包管理器:
使用APM: http://blog.aragon.one/using-apm-to-replace-npm-and-other-centralized-package-managers/ 部署APM: https://github.com/aragon/aragonOS#apm
这篇文章讨论了如何设置一个私有注册表
确保在系统中安装了couchdb 使用以下命令复制npmjs.org curl -X POST http://127.0.0.1:5984/_replicate -d '{"source":"http://isaacs.iriscouch.com/registry/", "target":"registry", "continuous":true, "create_target":true}' -H "Content-Type: application/json"
注意,该命令中有"continuous":true,这将利用CouchDB的_changes API,并在该API被通知时拉出任何新的更改。
如果你想停止这些复制,你可以很容易地添加"cancel":true。那么剧本就会
curl -X POST http://127.0.0.1:5984/_replicate -d '{"source":"http://isaacs.iriscouch.com/registry/", "target":"registry", "continuous":true, "create_target":true, "cancel":true}' -H "Content-Type: application/json"
然后转到npmjs.org自述me安装npm(确保安装了nodejs和git)。吹是所有的步骤
git clone git://github.com/isaacs/npmjs.org.git
cd npmjs.org
sudo npm install -g couchapp
npm install couchapp
npm install semver
couchapp push registry/app.js http://localhost:5984/registry
couchapp push www/app.js http://localhost:5984/registry
有一个容易使用的npm包可以做到这一点。 https://www.npmjs.org/package/sinopia
简而言之,Sinopia是一个私有/缓存npm存储库服务器,你可以用零配置来设置。
Sinopia可用于:
发布自己的私有包,而不向公众公开 只缓存所使用的公共包(不需要复制整个公共注册中心) 使用内部生成的修改版本覆盖公共包。
推荐文章
- ReferenceError: description没有定义NodeJs
- 将一个二进制的NodeJS Buffer转换为JavaScript的ArrayBuffer
- AngularJS只适用于单页应用程序吗?
- 如何在vue-cli项目中更改端口号
- 如何查看npm包的大小?
- 同步和异步编程(在node.js中)的区别是什么?
- 如何编辑通过npm安装的节点模块?
- “node_modules”文件夹应该包含在git存储库中吗
- 使用package.json在全局和本地安装依赖项
- this.libOptions.parse不是一个函数
- 对嵌套文件夹运行npm install的最好方法是什么?
- 节点Multer异常字段
- 在Ubuntu上安装Bower
- 很好的初学者教程socket.io?
- CALL_AND_RETRY_LAST分配失败-进程内存不足