这是我的问题.我们有一个私有的NPM注册表,只能在VPN中使用.我想有一个后备注册表https://registry.npmjs.org,这样当我离开VPN时,它可以无缝地工作.
PS目前我正在使用npmrc,它可以很好地切换.npmrc文件作为解决方法
我想用curlGitLab下载我的私人仓库.我知道我可以使用Gitlab API,但出于某种原因,它不起作用.
这可能吗?当我尝试这样做时,它总是返回登录页面.
我有多个项目在 monorepo: 中进行反应app1 app2 app3,每个应用程序都是使用 webpack 和 babel 构建的。
我想创建一个共享目录,其中包含应用程序之间的共享组件,因此我在 monorepo 中创建了另一个目录shared。
(我在每个项目中执行npm i ../shared)
但是当我从shared其中一个应用程序内部导入组件时,babel 会抛出异常:Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation. If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
注意:如果我从中导入简单的函数shared,它就可以工作,只有在导入组件时它才不起作用。
我可以添加什么配置才能创建包含共享组件的共享目录?
我在每个应用程序中的文件.babelrc如下所示
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": ["chrome >= 50"]
},
"useBuiltIns": "usage",
"corejs": …Run Code Online (Sandbox Code Playgroud) 对于初学者来说,我的问题与从 gitlab 私有存储库安装 npm 模块不同
我们维护自己的 npm 模块,每个模块都在自己的子文件夹中,并一起组成一个存储库,例如 my_node_modules.git,那么是否可以从中安装单个 npm 模块,即是否有一个我可以使用的命令/工具
npm i -S git+ssh://git@mydomain/path/my_node_modules.git/ A_module /
npm i -S git+ssh://git@mydomain/path/my_node_modules.git/ B_module /
如果不是,我必须安装那个单独的私有模块还有什么其他解决方案?
- - 更新 - -
经过一些研究后,我发现我并不孤单。
所以 npm 反对,https://github.com/npm/npm/issues/2974
纱线正在考虑,https://github.com/yarnpkg/yarn/issues/4725
我真的不喜欢这里的想法npm install package from github repo subfolder,postinstall sript
我正在考虑使用 git 子树。我在这里留下我的问题,看看是否有人可以提出一些想法。
我正在尝试安装一个存在于我们的私有仓库中的包。目标是与合作伙伴共享 repo,但我需要确保他们可以安装它。从理论上讲,它应该可以工作,但是没有任何记录在案的解决方案对我有用
我试过将包添加到 package.json 文件
"dependencies": {
"package_name": "git+https://<deploy-token-name>:<deploy-token>@gitlab.domain.com/group/repo.git"
}
Run Code Online (Sandbox Code Playgroud)
然后用 npm 安装,但它似乎在部署令牌上失败,但很难说,因为日志不是很有帮助,然后我们的整个 gitlab 部署会暂时停止#fun
29 error
29 error undefined
29 error exited with error code: 128
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用私有访问令牌
"package-name": "https://oauth2:<access-token>@gitlab.domain.com/group/repo.git"
Run Code Online (Sandbox Code Playgroud)
这导致了我可以理解的实际错误,除了错误是说存储库中没有 package.json,但肯定有
npm ERR! package.json Non-registry package missing package.json: package-name@https://oauth2:<access-token>@gitlab.domain.com/group/repo.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
Run Code Online (Sandbox Code Playgroud)
我已经尝试过使用 ssh(使用适用于提交等的 ssh 密钥设置)
git+ssh://git@my-domain.com:my-project/my-repo#my-branch
Run Code Online (Sandbox Code Playgroud)
这会导致错误
npm ERR! premature close
Run Code Online (Sandbox Code Playgroud)
我已经阅读了十几篇相关的问题和文章,但没有什么对我有用
我正在尝试在 gitlab 私有实例上使用我的第一个私有 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.
Run Code Online (Sandbox Code Playgroud)
但是当我想添加包时
npm install --save @ajouve/my-module
我有
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@ajouve/my-module Not …Run Code Online (Sandbox Code Playgroud) 我正在开发一个内部项目,想要在组内共享工具.
但如果我使用npm工具.它要么模块已经在npm网站上注册或公共git repo.
我正在使用gitlab.并且有一个私人令牌.
git+https://gitlab-ci-token:\<private token>@<domain>/<username>/<repo_name>.git
我试图在package.json中这样说,但它不起作用.
有没有办法用授权安装私人gitlab仓库?
非常感谢.
在这里输入图像描述我最近向package.JSON添加了一些依赖项,并尝试安装npm。但它显示与git相关的错误,也找不到
npm ERR!路径git
npm错误!代码ENOENT
npm ERR!errno ENOENT
npm ERR!syscall生成git
npm ERR!enoent执行时出错:
npm ERR!enoent未定义ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR!enoent
npm ERR!enoent
npm ERR!enoent生成git ENOENT
npm ERR!enoent这与npm无法找到文件有关。npm ERR!enoent
npm ERR!可以在以下位置找到此运行的完整日志:
我正在使用"firebase-functions": "^3.6.0"、"firebase-tools": "^8.0.0"来部署我的Angular: 10.0.14应用程序。一切都工作正常,直到我决定将一些组件移动到使用该命令创建的库中ng generate library,并将该包作为我的项目中的子模块./projects/my-lib
我使用构建库ng build my-lib
然后在我package.json安装的 lib 文件中
"my-lib": "file:dist/my-lib"
我在本地安装了该包,当我在本地测试它时它工作正常,但使用ng deploy进行部署引发了错误
npm ERR! Could not install from "dist/mce-lib" as it does not contain a package.json file.
我尝试了一些在网上找到的解决方案,但还没有成功