node.js - .npmrc 忽略了私有(private)包

标签 node.js npm

我正在尝试在 gitlab 私有(private)实例上使用我的第一个私有(private) npm 包
我添加了 @ajouve:registry=https://gitlab.my-website.io/api/v4/packages/npm/.npmrc命令npm get似乎返回了正确的配置

; "project" config from /Volumes/Work/service/.npmrc

@ajouve:registry = "https://gitlab.my-website.io/api/v4/packages/npm/" 

; "cli" config from command line options

omit = [] 
user-agent = "npm/7.5.4 node/v12.18.1 darwin x64" 

; node bin location = /usr/local/bin/node
; cwd = /Volumes/Work/service
; HOME = /Users/ajouve
; Run `npm config ls -l` to show all defaults.
但是当我想添加包时npm install --save @ajouve/my-module我有
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@ajouve/my-module Not found
npm ERR! 404 
npm ERR! 404  '@ajouve/my-module@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ajouve/.npm/_logs/2021-03-19T15_06_50_186Z-debug.log
转到 https://registry.npmjs.org
运行npm config ls -l | grep registry我有
metrics-registry = "https://registry.npmjs.org/"
registry = "https://registry.npmjs.org/"
@ajouve:registry = "https://gitlab.my-website.io/api/v4/packages/npm/"

最佳答案

代替 git://,使用 git+ssh://

npm i -S git+ssh://git@gitlab.com:<org>/<project>.git
在这里你可以得到几个答案
Install npm module from gitlab private repository

关于node.js - .npmrc 忽略了私有(private)包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66710861/

相关文章:

node.js - 为什么 `yarn upgrade my_package` 升级时不考虑 package.json 中的版本

node.js - Sails.js:在提供 res.view() 服务后如何继续运行代码?

ubuntu - 如何更新 npm

javascript - 咕噜声 : Destination File Same Name as Source File After Templating

json - CoffeeScript 中的 package.json 和 bower.json?

node.js - 将 typescript 代码发布到 npm 时如何处理 d.ts 文件

javascript - esprima-6 npm 模块发生了什么?

javascript - undefined 不是函数 : node error

javascript - DynamoDb 放入 node.js lambda 后合并异步 http 请求函数时出现问题

json - 无法使用 Firebase 和 ElasticSearch(使用 Flashlight)进行正确的路径监控或查询