最近我在安装 npm 包(使用 node-gyp)时遇到问题。我尝试将节点的次要版本从版本16.13.0升级到16.13.1,并将我的角度cli从13.0.2升级到13.2.0。一旦我得到要安装的包,我就生成了一个带有ng g library new-library
. 我不知道到底是什么破坏了它,但现在每当我尝试构建库时,它都会产生错误。我尝试ng build my-lib
得到以下错误。
\xe2\x9c\x96 Compiling with Angular sources in Ivy partial compilation mode.\nTransform failed with 1 error:\nerror: Invalid version: "15.2-15.3"\n
Run Code Online (Sandbox Code Playgroud)\n我尝试恢复节点和角度 cli 的版本,但它没有解决问题。我什至将代码恢复到原始状态,现在出现错误。这是我的环境有问题吗?我该如何解决这个问题?
\n我正在构建一个连接到 redis 的 Nodejs 应用程序。我将此与我的本地 redis 实例一起使用。现在,我正在使用ioredis
Nodejs 应用程序连接到 AWS 中 k8s 中的 Redis 集群。这是我所拥有的。
const Redis = require("ioredis");
this.redis = new Redis({
port: 6379, // Redis port
host: rhost, // Redis host
password: password
});
this.redis.on('connect', () => {
console.log('connected to redis')
})
Run Code Online (Sandbox Code Playgroud)
connected to redis
当消息在日志中打印出来时,我似乎成功连接到集群。但是,每次我尝试使用我的 redis 对象时,都会收到 MOVED 错误:
UnhandledPromiseRejectionWarning: ReplyError: MOVED 5011 <ip address>:6379
at parseError (/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/node_modules/ioredis/node_modules/redis-parser/lib/parser.js:302:14)
Run Code Online (Sandbox Code Playgroud)
该连接适用于我的本地。然而,在 AWS 中却并非如此。我尝试使用Redis.Cluster
对象而不是进行交换Redis
,但是在部署应用程序后,应用程序挂起并且连接事件永远不会触发。和事件似乎无限循环close
。reconnecting
据我了解,这是集群中节点之间重定向的问题。可能是主/从配置的问题。该错误是 AWS 中的配置问题吗?我需要使用Redis.Cluster
对象而不是普通 …
我正在将我的应用程序从 d3 v5 升级到 v6,并且在迁移 d3.mouse 功能时遇到了问题。在我的应用程序中,我将变换应用于顶级 svg 组并使用缩放功能进行缩放和平移(缩放和平移)。当我双击屏幕时,我会占据鼠标位置并绘制一个正方形。
现在我用 d3.pointer 替换 d3.mouse 函数。在我的双击事件中,我通过调用d3.pointer(event)
. 但是,此函数不会产生与我的顶级 svg 组的定位和缩放位置相关的位置。当我从顶级组中删除翻译和缩放时,位置匹配。
在旧版本的 d3 中,我可以调用d3.mouse(this.state.svg.node())
它,它会产生我点击的准确位置,并针对平移和缩放进行了校正。这在版本 6 中可用吗?如果没有,是否有一种干净的方法可以对此进行调整?新的事件对象带有许多不同的位置属性:pagex、offsetx、screenx、x。这些都没有产生我点击的位置。有没有一种干净的方法来实现这一目标?
我有一个 Angular 12 解决方案,它有两个项目:一个是库,另一个是应用程序。我将它们从使用 tslint 转换为 eslint。我使用了以下命令:
ng add @angular-eslint/schematics
ng g @angular-eslint/schematics:convert-tslint-to-eslint my-app
ng g @angular-eslint/schematics:convert-tslint-to-eslint my-library
我的库使用与应用程序不同的前缀。当我运行时,ng lint
出现以下错误:
The selector should start with one of these prefixes: "app" (https://angular.io/guide/styleguide#style-02-07) @angular-eslint/component-selector
.eslintrc.json
我在应用程序和库的根目录和顶部项目目录中有一个文件。我尝试将组件选择器前缀的条目更改为lib
库项目文件夹中的 .eslintrc.json 文件:
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lib",
"style": "kebab-case"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这并不能解决问题。如何为我的库注册自定义前缀才能消除此错误?
我正在开发一个 Angular 10 应用程序,它利用 Azure B2C 进行策略和用户管理。我在 Azure Active Directory 中将我的应用注册设置为单页应用,但未选中隐式选项。我正在使用 msal.js 2.0@azure/msal-browser
登录 B2C 并使用代码流检索 ID 和访问令牌。我设置了我的配置,创建了 msal 对象,定义了重定向承诺,然后使用适当的用户范围调用 loginRedirect。页面正确重定向。
但是,在我登录后,tokenResponse 返回为空。我曾尝试更改权限和范围,但它总是返回为空。如何让handleRedirectPromise
返回有效的令牌响应?
这是我的代码:
private msalConfig: Msal.Configuration = {
auth: {
clientId: xxxx-xx-xx-xx-xxxxx,
authority: 'https://login.microsoftonline.com/common',
redirectUri: 'https://localhost:4200'
},
cache: {
cacheLocation: 'sessionStorage',
storeAuthStateInCookie: false
},
};
private loginRequest: Msal.RedirectRequest = {
scopes: ['user.read'],
};
const msalInstance = new Msal.PublicClientApplication(this.msalConfig);
msalInstance
.handleRedirectPromise()
.then((tokenResponse: Msal.AuthenticationResult) => {
let accountObj = null;
if (tokenResponse !== null) {
accountObj = tokenResponse.account; …
Run Code Online (Sandbox Code Playgroud) 我想查询 Azure AD Graph API 以从注册的 Azure B2C 应用中检索登录用户的组声明。我正在调用的应用程序是 Angular 5 SPA。
在试用 Azure Active Directory 和 adal-angular4 后,我成功检索了用户的自定义角色 claim。为此,我注册了一个 Azure AD 应用程序,设置了所需的权限范围,向应用程序的清单中添加了自定义角色,将用户添加到了应用程序中,并为用户设置了自定义角色。然后,我将我新注册的应用程序的应用程序 ID 和租户用于 adal-angular4 配置。当我查询端点时,我得到包含角色声明的令牌。它运作良好。当我更改角色时,它会显示在令牌中。
这个角色声明对我来说已经足够了,但它需要两次登录,一次用于我的 B2C 应用程序,另一次用于我的其他注册应用程序。我不认为我可以对两者使用相同的令牌。
为了只有一个登录,我想直接查询Azure B2C。我听说它不提供查询用户角色的功能,如 Azure Active Directory,并且已被定向到使用用户组。我还看过文档,并被告知我需要使用 Azure Graph API,因为 Microsoft Graph 尚未实现查询此信息的功能。
我尝试遵循与 AAD 一起使用的类似 B2C 路径。我创建了一个组并向该组添加了一个用户。我尝试使用 MSAL.js通过 Azure Graph API 端点https://graph.windows.net/myorganization/users?api-version=1.6访问我的 B2C 应用程序的信息,但出现错误“代码”:“Authentication_MissingOrMalformed” . 我验证了 MSAL 检索了令牌并已将其添加到请求中。当我将 url 更改为无效的 url 时,我收到相同的错误。我在这里,这里搜索并发现了相同问题的问题,但没有人回答
我该如何解决这个错误?
是否有必要拥有本地管理员帐户?
我需要在我的 B2C 应用程序上设置任何特殊的范围来授予我的查询授权吗?如果有,具体是什么?我试图将范围的不同值交换到 …
我正在探索 Argo 来协调处理大数据。我希望通过 REST 调用启动一个工作流,该工作流在具有所需处理资源的许多机器之间划分大型数据集。从架构的角度来看,我将如何实现这一点?是否有 REST api 或一些我可以使用的 Node.js 库?
我正在使用 msal.js v1.3 将应用程序升级到 v2.3,并且在获取 id 令牌后检索访问令牌时遇到问题。
我在构造函数中初始化了handleRedirectPromise。然后,当用户单击登录按钮时,我调用 loginRedirect 并传入一个具有 openid 范围和来自我单独注册的 api 的范围的对象。这很有效,id 令牌返回,我调用 acquireTokenSilent 来检索我的访问令牌。我将一个包含我注册的 api 范围和帐户的对象从 loginRedirect 调用传递到此函数中。
问题是来自 acquireTokenSilent 的授权响应具有空的访问令牌。令牌端点的结果如下所示:
client_info: "xx"
id_token: "xx"
not_before: 1602895189
refresh_token: "xx"
refresh_token_expires_in: 1209600
scope: ""
token_type: "Bearer"
Run Code Online (Sandbox Code Playgroud)
它没有访问令牌,但它确实指定了令牌类型,因为Bearer
响应中没有访问令牌,并且看起来返回的范围属性为空。这是我的代码:
client_info: "xx"
id_token: "xx"
not_before: 1602895189
refresh_token: "xx"
refresh_token_expires_in: 1209600
scope: ""
token_type: "Bearer"
Run Code Online (Sandbox Code Playgroud)
为什么访问令牌没有从令牌端点返回?这与范围返回空有关吗?我尝试删除范围并放入无效条目,然后出现错误,所以我知道我的请求至少是有效的。另外,为了验证一下,我在 AAD 中有 2 个应用程序注册,一个是我为我的 spa 创建的,具有代码流,另一个是我为我的 api 创建的旧注册,具有公开的 api 和范围。
我正在本地构建 .NET Core 3.1 Azure Functions 应用程序,并尝试配置启动类。当我实现一个要继承的类时,FunctionsStartup
我无法将 .net core 3.1 类库导入到我的项目中。如果我这样做并尝试运行该应用程序,我会在执行窗口中收到以下错误:
Microsoft.Azure.Functions.Extensions: Method not found: Microsoft.Extensions.Configuration.IConfigurationBuilder Microsoft.Azure.WebJobs.Hosting.IWebJobsConfigurationBuilder.get_ConfigurationBuilder()'. Value cannot be null. (Parameter 'provider')
当我将 Startup 基类切换到IWebJobsStartup
应用程序时,启动正常。当我提出请求并尝试单步执行代码时,我遇到了问题。我可以单步执行代码的初始部分(所以我知道我的请求已成功接收),但我无法单步执行我的其中一个功能。我收到一个下载提示,并在 VS 工作区中打开一个页面,其中包含TaskMethodInvker.cs not found
带有标记行的错误消息You need to find TaskMethodInvoker.cs to view the source for the current call stack frame
。下面的代码显示了我的功能:
[FunctionName("HttpAuth")]
public async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ExecutionContext context,
ILogger log)
{
GetAzureADConfiguration(context);
var jwt = GetJwtFromHeader(req);
}
private JwtSecurityToken GetSecurityToken(string encodedToken) …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个pre-commit==2.15.0
已添加到 python 需求文件中的项目。我安装了要求。现在,当我尝试执行以下操作时,git commit
出现以下错误:
An unexpected error has occurred: ExecutableNotFoundError: Executable `/bin/sh` not found
Check the log at C:\Users\username\.cache\pre-commit\pre-commit.log
Run Code Online (Sandbox Code Playgroud)
在我的预提交日志中,我有:
pre-commit version: 2.15.0
sys.version:
3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
sys.executable: c:\users\username\appdata\local\programs\python\python39\python.exe
os.name: nt
sys.platform: win32
Traceback (most recent call last):
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\pre_commit\error_handler.py", line 65, in error_handler
yield
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\pre_commit\main.py", line 368, in main
return hook_impl(
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\pre_commit\commands\hook_impl.py", line 231, in hook_impl
retv, stdin = _run_legacy(hook_type, hook_dir, args)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\pre_commit\commands\hook_impl.py", line …
Run Code Online (Sandbox Code Playgroud) angular ×3
azure-ad-b2c ×3
msal.js ×2
.net-core ×1
angular-ivy ×1
argoproj ×1
azure ×1
c# ×1
d3.js ×1
eslint ×1
ioredis ×1
kubernetes ×1
node-redis ×1
pre-commit ×1
python ×1
python-3.x ×1
redis ×1
workflow ×1