小编Use*_*250的帖子

找不到模块在Heroku上部署时出错

我试图在Github上将我的应用程序部署到Heroku但是收到错误:

./src/Index.tsx中的错误找不到模块:错误:无法解析'/ app/src'中的'./ConfigureStore'@ ./src/Index.tsx 9:23-50

我在Heroku上部署时看起来像Typescript问题.

虽然,在我的本地和webpack工作完美生成捆绑和应用运行良好.下面是我的webpack.config:

const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
const rootModulePath = "./src/";

module.exports = {
    stats: { modules: false },
    resolve: {
        extensions: ['.js', '.jsx', '.ts', '.tsx', '.css']
    },
    entry: {
        'DIG': rootModulePath + "Index.tsx"
    },
    externals: {
        jQuery: 'jQuery'
      },
      node: {
        fs: 'empty'
      },
    plugins: [
        new webpack.ProvidePlugin({
            '$': 'jquery',
            'jQuery': 'jquery'
          }),
        new webpack.IgnorePlugin(/\.\/locale$/),
        new CheckerPlugin()        
    ],
    devtool: 'source-map',
    output: {
        path: …
Run Code Online (Sandbox Code Playgroud)

heroku typescript reactjs react-tsx

7
推荐指数
1
解决办法
2890
查看次数

为角度材料datePicker设置默认值,角度为5

我正在使用有角材料制成的日期选择器。我想设置一个默认值,但未显示该值。

<mat-form-field class="mr-sm-24" fxFlex (click)="open()" >
   <input matInput [picker]="picker" placeholder="Date"
                  autocomplete="off"
                  name="date" 
                  formControlName="date">
   <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
   <mat-datepicker  [startAt]="startDatePicker" #picker></mat-datepicker>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

这是我的.js代码,我想将其设置为默认值

var date = this.datepipe.transform((new Date().getTime()) - 3888000000, 'dd/MM/yyyy'); 

this.form = this.formBuilder.group({
        dataInicial: [data_inicial],
                   ...
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular angular-material-datetimepicker

6
推荐指数
4
解决办法
1万
查看次数

Angular matDatepicker 语言环境无法在输入框中输入

如果我使用日期选择器

<mat-form-field>
  <input matInput [matDatepicker]="picker" placeholder="Choose a date">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker></mat-datepicker>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

并设置一个语言环境

  providers: [    
    { provide: LOCALE_ID, useValue: 'it-IT' },
    { provide: MAT_DATE_LOCALE, useValue: 'it-IT' }]
Run Code Online (Sandbox Code Playgroud)

如果用户从选择器中选择日期,它会起作用,但如果他在输入框中键入,则日期没有以正确的方式解析。例如:如果用户在框中选择 2018 年 3 月 31 日,则意大利格式为 dd/mm/yyyy,我们会得到“31/03/2018”(没关系)但如果他输入“31/03/2018”,则日期不是验证(但它是一个有效的意大利日期)。如果他输入“03/05/2018”,我们会得到 3 月 5 日而不是 5 月 3 日。是角度材料错误还是我犯了一些错误?

我也试过用“it”代替“it-IT”。

locale angular-material angular angular-material-datetimepicker

6
推荐指数
1
解决办法
1163
查看次数

Mat 分页器更改工具提示位置

我正在尝试将工具提示放置mat-paginator在更靠近分页按钮的位置。目前,工具提示距离太远,如下所示:

在此输入图像描述

我尝试更新.cdk-overlay-pane.mat-tooltip-panel课程,但对我不起作用。任何积分都受到高度赞赏!

angular-material angular

5
推荐指数
1
解决办法
3075
查看次数

升级 cli 版本 7.3.6 后,.scss 中的加载程序中的错误未返回字符串

ng update在运行时使用以下错误升级了我的项目ng build --prod

加载程序“...\ClientApp\src\app\nav-menu\nav-menu.component.scss”中的错误未返回字符串。

下面是我的 package.json 依赖项:

"dependencies": {
"@angular/animations": "7.2.11",
"@angular/cdk": "7.3.6",
"@angular/common": "7.2.11",
"@angular/compiler": "7.2.11",
"@angular/core": "7.2.11",
"@angular/forms": "7.2.11",
"@angular/http": "7.2.11",
"@angular/material": "7.3.6",
"@angular/material-moment-adapter": "7.3.6",
"@angular/platform-browser": "7.2.11",
"@angular/platform-browser-dynamic": "7.2.11",
"@angular/platform-server": "7.2.11",
"@angular/router": "7.2.11",
"@aspnet/signalr": "1.1.2",
"@ng-idle/core": "^6.0.0-beta.4",
"@nguniversal/module-map-ngfactory-loader": "^7.1.1",
"aspnet-prerendering": "3.0.1",
"bootstrap": "^4.3.1",
"bootstrap4-datetimepicker": "^5.2.3",
"core-js": "^2.6.5",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"highcharts": "6.1.4",
"jquery": "^3.3.1",
"moment": "^2.24.0",
"node-sass": "^4.11.0",
"primeng": "^7.1.0",
"rxjs": "^6.4.0",
"zone.js": "^0.9.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.13.6",
"@angular/cli": "7.3.6",
"@angular/compiler-cli": "", …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc angular

4
推荐指数
1
解决办法
2527
查看次数

升级到 .Net Core 3.1 后,Liveness/Readiness 探测失败

我将 .Net Core 2.1 升级到 3.1。升级 Pod 的 Liveness 和 Readiness 探测失败后。下面是我的 docker 文件片段:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
ENTRYPOINT ["dotnet", "Web.dll"]
Run Code Online (Sandbox Code Playgroud)

当我检查 pod 的日志时,出现以下错误:

无法绑定到IPv6 环回接口上的http://localhost:5000 :“无法分配请求的地址”

活动探测失败:获取http://yyyy:80/:拨打 tcp yyyy:80: 连接:连接被拒绝

这是我的Deployment.yaml文件:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "staging.fullname" . }}
  namespace: staging
  labels:
    app.kubernetes.io/name: {{ include "staging.name" . }}
    helm.sh/chart: {{ include "staging.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc docker kubernetes asp.net-core angular

4
推荐指数
1
解决办法
2087
查看次数

将无选项卡设置为垫选项卡上的默认活动选项卡

我已经使用实施了搜索功能mat-tab,不需要在初始加载时选择任何标签。仅当用户单击特定选项卡时,选项卡才应激活。

当前,第一个选项卡在加载时处于活动状态。我尝试设置selectedIndex="null"但没有用。另外,我需要在单击按钮时重置选定的选项卡。

使用垫标签搜索

angular-material angular mat-tab

3
推荐指数
1
解决办法
2707
查看次数

将数据从Dictionary批量设置为Redis

我正在使用StackExchange Redis DB插入键值对的字典,Batch如下所示:

private static StackExchange.Redis.IDatabase _database;
public void SetAll<T>(Dictionary<string, T> data, int cacheTime)
{
    lock (_database)
    {
        TimeSpan expiration = new TimeSpan(0, cacheTime, 0);
        var list = new List<Task<bool>>();
        var batch = _database.CreateBatch();               
        foreach (var item in data)
        {
            string serializedObject = JsonConvert.SerializeObject(item.Value, Formatting.Indented,
        new JsonSerializerSettings { ContractResolver = new SerializeAllContractResolver(), ReferenceLoopHandling = ReferenceLoopHandling.Ignore });

            var task = batch.StringSetAsync(item.Key, serializedObject, expiration);
            list.Add(task);
            serializedObject = null;
        }
        batch.Execute();

        Task.WhenAll(list.ToArray());
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题:只设置350项字典需要7秒钟左右。

我的问题:这是将批量商品放入Redis的正确方法,还是有一种更快的方法?任何帮助表示赞赏。谢谢。

c# redis stackexchange.redis

2
推荐指数
2
解决办法
1979
查看次数

Serilog 不会将日志写入 AWS Elasticsearch Service

我正在使用 Serilog 将日志写入我的 .NET Core 应用程序中的AWS Elasticsearch Service,但在登录 Kibana 时,我没有看到任何写入的日志。

public Startup(IConfiguration configuration, IHostingEnvironment hostingEnvironment)
{
    const string esUrl = "https://aws-es-thinger.us-west-1.es.amazonaws.com";
    Log.Logger = new LoggerConfiguration()
        .Enrich.FromLogContext()
        .Enrich.WithExceptionDetails()
        .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(esUrl))
        {
            ModifyConnectionSettings = conn =>
            {
                var httpConnection = new AwsHttpConnection("us-east-1");
                var pool = new SingleNodeConnectionPool(new Uri(esUrl));
                var conf = new ConnectionConfiguration(pool, httpConnection);
                return conf;
            },
            AutoRegisterTemplate = true
        }).CreateLogger();
}
Run Code Online (Sandbox Code Playgroud)

我可以用来HttpClient成功获得响应。

此外,我还可以从浏览器加载 Kibana 和 ElasticSearch 网址。请帮我解决我在这里缺少的东西。

编辑 在启动时连接时出现以下错误:

System.Net.Http.WinHttpException:无法建立与服务器的连接

asp.net-mvc amazon-web-services elasticsearch serilog amazon-elasticsearch

2
推荐指数
1
解决办法
1353
查看次数

部署在 TomCat 上时,我的 Angular + Spring 应用程序路由不起作用

我对角度和弹簧非常陌生。我可能犯了一些愚蠢的错误。我有 Angular + Spring 应用程序,它显示登录屏幕,然后显示菜单。这在未部署时完美运行(即当 Angular 和 Spring 并行运行时)但是当我在 tomcat 上部署应用程序时,它不显示登录表单。我按照以下步骤进行部署 -

  1. ng build --base-href=./
  2. 将所有文件从 angular dist 文件夹复制到 spring 静态文件夹
  3. 在 spring 中创建 .war 文件并在 tomcat 中部署它

我的 pom.xml

<groupId>com.techence</groupId>
        <artifactId>new</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>war</packaging>

        <name>LoginDemoBackend</name>
        <description>Demo project for Spring Boot</description>

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.4.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
        </properties>

        <dependencies>

        <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>


            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-configuration-processor</artifactId>
                <optional>true</optional> …
Run Code Online (Sandbox Code Playgroud)

java spring typescript angular

2
推荐指数
1
解决办法
1490
查看次数

未调用表单组异步验证器函数

我需要实现依赖于多个表单字段的异步验证,所以我将验证放在FormGroup. 但是没有调用验证函数。当然我错过了一些东西。

heroForm: FormGroup;

  ngOnInit(): void {
    this.heroForm = new FormGroup({
      'name': new FormControl(this.hero.name, [
        Validators.required,
        Validators.minLength(4),
        forbiddenNameValidator(/bob/i)
      ]),
      'alterEgo': new FormControl(this.hero.alterEgo, {        
        updateOn: 'blur'
      }),
      'power': new FormControl(this.hero.power, Validators.required)
    }, null,this.validate.bind(this));
  }

  validate(
    ctrl: FormGroup
  ): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
    console.log(ctrl)
    return this.heroesService.isAlterEgoTaken(ctrl.controls.alterEgo.value).pipe(
      map(isTaken => { 
        console.log(isTaken);
        return (isTaken ? { uniqueAlterEgo: true } : null)
        }),
      catchError(() => null)
    );
  }
Run Code Online (Sandbox Code Playgroud)

在这里创建了一个演示:https : //stackblitz.com/edit/angular-xtqhqi

angular-validation angular angular-forms

0
推荐指数
1
解决办法
1769
查看次数