当前位置: 首页 > news >正文

项目如何安装本地tgz包并配置局部registry

一、判断包来源是否正确

1. 检查url

curl <registry_url>

2. 查看包是否存在

npm view <package_name> --registry=<registry_url>

二、局部registry配置步骤:

1. 全局配置

如果你希望对所有项目生效,可以将这行配置添加到全局.npmrc 文件中。全局 .npmrc文件通常位于以下路径:

  • Windows: C:\Users\<YourUsername>\.npmrc

添加内容:

@sdp.nd:registry=http://registry.npm.sdp.nd

2. 项目级配置

如果你只希望对当前项目生效,可以在项目根目录下创建或编辑 .npmrc 文件(与 package.json同级)。

添加内容:

@sdp.nd:registry=http://registry.npm.sdp.nd

3. 验证配置

配置完成后,可以运行以下命令验证:

npm config get @sdp.nd:registry

如果输出为 http://registry.npm.sdp.nd,说明配置成功。

4. 登录私有仓库(如果需要)

如果私有仓库需要身份验证,运行以下命令登录:

npm login --registry=http://registry.npm.sdp.nd --scope=@sdp.nd

输入用户名、密码和邮箱完成登录。


三、安装该SDK

执行以下命令,可以看到所有@sdp.nd的包从http://registry.npm.sdp.nd下载,其它包则从全局默认的registry下载

npm install --verbose

$ npm install --verbose
npm verb cli D:\node\node.exe D:\node\node_modules\npm\bin\npm-cli.js
npm info using npm@10.2.4
npm info using node@v20.11.0
npm verb title npm install
npm verb argv “install” “–loglevel” “verbose”
npm verb logfile logs-max:10 dir:C:\Users\Administrator\AppData\Local\npm-cache_logs\2025-03-29T12_55_13_064Z-
npm verb logfile C:\Users\Administrator\AppData\Local\npm-cache_logs\2025-03-29T12_55_13_064Z-debug-0.log
npm http fetch GET 200 http://registry.npm.sdp.nd/@sdp.nd%2fnd-uc-sdk 170ms (cache revalidated)
npm http fetch GET 200 http://registry.npm.sdp.nd/@sdp.nd%2frequest-adapter-waf 66ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/crypto-js 836ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/nd-base64 849ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/lodash 987ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/nd-md5s 1054ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@babel%2fruntime 1061ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/nd-datetime 1120ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/nd-uri-parser 1322ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@gem-mine%2frequest 1441ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/axios 259ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/regenerator-runtime 275ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@gem-mine%2frequest-adapter-xhr 546ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/follow-redirects 263ms (cache updated)
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 295ms
npm http fetch GET 200 http://registry.npm.sdp.nd/@sdp.nd/nd-uc-sdk/download/@sdp.nd/nd-uc-sdk-1.9.34.tgz 346ms (cache miss)

一般上述命令能够安装成功,如果不能,也可以下载包的.tgz文件到本地,运行如下安装命令即可:

npm install ./*.tgz --save
http://www.dtcms.com/a/98874.html

相关文章:

  • NixVis 开源轻量级 Nginx 日志分析工具
  • 鸿蒙开发:了解Canvas绘制
  • [C++项目]高并发内存池性能测试
  • 音乐推荐系统的研究与应用
  • JAVA学习*单列模式
  • Linux进程状态补充(10)
  • 18-动规-子序列中的 k 种字母(中等)
  • Python --- .flush() 强制输出缓冲区的数据(缓冲区未满)
  • 代码随想录算法训练营--打卡day3
  • HTML元素小卖部:表单元素 vs 表格元素选购指南
  • 从零开始研发GPS接收机连载——19、自制GPS接收机的春运之旅
  • 《Spring Cloud Eureka 高可用集群实战:从零构建高可靠性的微服务注册中心》
  • 【RabbitMQ】Linux上安装RabbitMQ详细步骤
  • 全球化2.0 | ZStack举办香港Partner Day,推动AIOS智塔+DeepSeek海外实践
  • 嵌入式libc
  • [创业之路-344]:战略的本质是选择、聚焦, 是成本/效率/低毛利优先,还是差易化/效益/高毛利优先?无论是成本优先,还是差易化战略,产品聚焦是前提。
  • 基于HTML5和CSS3实现3D旋转相册效果
  • linux课程学习二——缓存
  • JAVA的内存图理解
  • C/C++回调函数实现与std::function和std::bind介绍
  • 综合实验2
  • std::scoped_lock vs std::unique_lock:多线程锁的选择指南
  • mysql.8.4.4主从配置--IOthread:NO
  • 图解CMS原理是什么?漏标+多标+浮动垃圾 如何解决?
  • LeetCode1两数之和
  • Ubuntu社区论坛正确网址
  • Elea AI:以人工智能之力推动病理实验室革新的技术突破与实践探索
  • 10-项目需求变更时如何处理
  • sqli-labs靶场 less 9
  • Banner区域