尝试使用npm i命令安装 npm 包时,出现以下异常:
我尝试重新安装节点 js 包并将代理设置为关闭使用:
set HTTP_PROXY=
set HTTPS_PROXY=
Run Code Online (Sandbox Code Playgroud)
问题仍然存在。我做错了什么?
更新:
当我运行以下命令时:
npm install --legacy-peer-deps
Run Code Online (Sandbox Code Playgroud)
我们正在为我们的私人项目使用GitLab.有一些来自github的分叉库,我们想要安装为npm模块.直接从npm安装该模块是可以的,例如:
npm install git://github.com/FredyC/grunt-stylus-sprite.git
...也正常工作,但对GitLab做同样的事情,只是更改域名会让我犯这个错误.
npm WARN `git config --get remote.origin.url` returned wrong result (git://git.domain.com/library/grunt-stylus-sprite.git)
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git Cloning into bare repository 'D:\users\Fredy\AppData\Roaming\npm-cache\_git-remotes\git-git-domain-com-library-grunt-stylus-sprite-git-6f33bc59'...
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git fatal:unable to connect to git.domain.com:
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git git.domain.com[0: 77.93.195.214]: errno=No error
npm ERR! Error: Command failed: Cloning into bare repository 'D:\users\Fredy\App
Data\Roaming\npm-cache\_git-remotes\git-git-domain-com-library-grunt-stylus-spr
ite-git-6f33bc59'...
npm ERR! fatal: unable to connect to git.domain.com:
npm ERR! git.domain.com[0: xx.xx.xx.xx]: errno=No error
Run Code Online (Sandbox Code Playgroud)
从GitLab的Web界面,我有这个URL
git@git.domain.com:library/grunt-stylus-sprite.git.针对npm install它运行此尝试git从npm注册表安装模块. …
我正在尝试使用 GitHub 操作为 Node.js 项目运行构建。作为 的一部分npm install,我需要直接从私有 GitHub 存储库(而不是来自 GPR!)安装 npm 模块。
在package.json我有:
"dependencies": {
...
"my-module": "github:<org>/<my-module>#master",
...
},
Run Code Online (Sandbox Code Playgroud)
但是,在运行时npm install,我得到:
npm 错误!git@github.com:权限被拒绝(公钥)。npm 错误!致命:无法从远程存储库读取。
存储库是我自己组织的一部分,它在本地(即从我的机器)工作。我怎样才能让这个运行?
我已经尝试设置NODE_AUTH_TOKEN环境变量,但没有任何区别。尽管您经常发现此建议,但它似乎只针对 GPR。我想避免的是必须将令牌硬编码到package.json文件中。对此有何想法?
我在我的全局.npmrc文件中配置了一个私有注册表.现在我想在同一个npmrc文件中配置一个回退注册表.当npm无法在我的私有存储库中找到模块时,我希望它从npm全局注册表中下载它,即https://registry.npmjs.org
以下是我要配置的两个存储库:
http://devint:9999/nexus/content/groups/NPM-Release //npm should first look into this
https://registry.npmjs.org // fallback registry
Run Code Online (Sandbox Code Playgroud)
我知道StackOverflow上有一个针对这个类似问题的解决方案,但是这些解决方案建议使用范围包方法.我不想使用范围包方法在npmrc文件中配置多个存储库.
我已经完成了可用的解决方案 是否有任何方法可以在单个npmrc文件中配置多个注册表 但是我正在寻找一种不同的方法,我可以在npmrc文件中定义多个存储库,其优先级在npmrc文件中.
我要求在没有给出令人满意的正确答案的情况下不将此问题标记为已结束
谢谢.
我天真地假定带有双斜杠('//')的.npmrc行表示注释,但是显然不是这样,因为删除它们时,我无法发布到本地注册表。
例:
registry=https://npm.myregistry.io/
//email=me@mydomain.com
//npm.myregistry.io/:_authToken="Pgwb34F123EQdHqE7OoZA=="
Run Code Online (Sandbox Code Playgroud)
如果删除以上//行,则将结果发布到
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
Run Code Online (Sandbox Code Playgroud)
我在npmrc文档或ini模块解析器文档中找不到对该语法的任何引用。我假设它与合成属性有关?