小编Cle*_*ent的帖子

Spring Initializr基本项目无法生成

我在以下设置中使用SPRING INITIALIZR:

  • 爪哇
  • 马文
  • 2.0.0(快照)
  • 网页
  • JPA
  • H2
  • 胸腺
  • 执行器

我每次尝试运行./mvnw spring-boot:run它都会因此错误而失败。不知道出了什么问题。我曾尝试在spring Initializr中使用其他项目变体,并使用删除我的所有Maven存储库mvn dependency:purge-local-repository。重建成功,但是当我尝试启动Spring时,出现了此问题。

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate

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

运行 Angular Universal 时未应用 Angular Material Styles

可以看到浏览器加载了样式,加载的css中加载了材质类。

跑步水疗 ng serve

在此处输入图片说明

运行 Angular 通用

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

angular.json - Architect.build.options

"styles": [
    "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
    "src/styles.scss",
    "node_modules/ngx-toastr/toastr.css"
],
Run Code Online (Sandbox Code Playgroud)

angular.json - Architect.server

"server": {
    "builder": "@angular-devkit/build-angular:server",
    "options": {
        "outputPath": "dist/server",
        "main": "src/main.server.ts",
        "tsConfig": "src/tsconfig.server.json"
    },
    "configurations": {
        "staging": {
            "fileReplacements": [
                {
                    "replace": "src/environments/environment.ts",
                    "with": "src/environments/environment.staging.ts"
                }
            ],
            "optimization": false,
            "outputHashing": "all",
            "sourceMap": true,
            "extractCss": true,
            "namedChunks": false,
            "aot": true,
            "extractLicenses": true,
            "vendorChunk": false,
            "buildOptimizer": true,
            "budgets": [
                {
                    "type": "initial",
                    "maximumWarning": "2mb",
                    "maximumError": "5mb"
                }
            ]
        }
    }
},
Run Code Online (Sandbox Code Playgroud)

服务器.ts

server.tsAngular …

angular-universal angular

5
推荐指数
0
解决办法
297
查看次数

Gradle 5.0 在 buid.gradle.kts 中使用 Kotlin DSL 时导致错误 Val无法重新分配

这个错误在 gradle 版本 4.10.2 中没有发生

该行classDirectories = files(filesToCover)导致 gradle 抛出错误:

* What went wrong:
Script compilation error:

  Line 80:             classDirectories = files(filesToCover)
                       ^ Val cannot be reassigned
Run Code Online (Sandbox Code Playgroud)

但是,当您查看底层 Java 类时,JacocoReportBase您可以清楚地看到有一个 setter,并且类属性不是最终的。

public abstract class JacocoReportBase extends JacocoBase {
    private FileCollection executionData;
    private FileCollection sourceDirectories;
    private FileCollection classDirectories;
    private FileCollection additionalClassDirs;
    private FileCollection additionalSourceDirs;

    ...

    public void setClassDirectories(FileCollection classDirectories) {
        this.classDirectories = classDirectories;
    }
Run Code Online (Sandbox Code Playgroud)

构建.gradle.kts

tasks {
    withType<KotlinCompile<KotlinJvmOptions>> {
        kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
        kotlinOptions.jvmTarget = "1.8"
    } …
Run Code Online (Sandbox Code Playgroud)

gradle kotlin

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

Loopback 4 中间件未注册

在这里按照这个示例进行简单的日志记录中间件设置。但我似乎无法让它记录我的请求信息。当我点击 时,我得到了标准响应/ping,但没有任何内容被注销到控制台。

我尝试在两个不同的位置注册中间件。index.tsapplication.ts

// src/middleware/log.middleware.ts

import { Next } from '@loopback/core'
import { Middleware, MiddlewareContext } from '@loopback/rest'

export const testLoggingMiddleware: Middleware = async (
  middlewareCtx: MiddlewareContext,
  next: Next,
) => {
  const { request } = middlewareCtx
  console.log('Request: %s %s', request.method, request.originalUrl)
  try {
    // Proceed with next middleware
    await next()
    // Process response
    console.log('Response received for %s %s', request.method, request.originalUrl)
  } catch (err) {
    // Catch errors from downstream middleware …
Run Code Online (Sandbox Code Playgroud)

node.js typescript loopbackjs loopback4

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

NX monorepo fatal:没有这样的参考:'main~1'

我正在尝试在启用 nx 云的 github actions 中构建我的 nx 应用程序。我总是收到fatal: No such ref: 'main~1'错误。

该命令nx affected --target=build --base=main~1 --head=HEAD --parallel --with-deps在我提交之前有效,但在我提交之后,该命令在本地或 ci 中不再有效。

根据文档,将基础设置为main~1应该仅将其与主分支的先前提交进行比较。

Github Actions 中的完整错误:

yarn run v1.22.10
$ nx affected --target=build --base=main~1 --head=HEAD --parallel --with-deps
fatal: Not a valid object name main~1
fatal: No such ref: 'main~1'
nx affected

Run task for affected projects

Run command using --base=[SHA1] (affected by the committed, uncommitted and
untracked changes):
  --base  Base of the current branch (usually …
Run Code Online (Sandbox Code Playgroud)

javascript git monorepo github-actions

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

npm cors 包不工作

即使安装了 npm 软件包,我也无法访问我的服务器cors

import Express from 'express';
import compression from 'compression';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import cors from 'cors';

/**********************

 SERVER CONFIG

 *********************/

import serverConfig from './config';
import auth from './routes/v1/auth.routes'

// Initialize Express
const app = new Express();

// DB Setup
mongoose.connect(serverConfig.mongoUrl, error => {
  if (error) {
    throw new Error('Please make sure Mongodb is installed and running!');
  } else {
    console.log(`MongoDB is running on port ${serverConfig.mongoUrl}`);
  }
});
mongoose.Promise = global.Promise;

/********************** …
Run Code Online (Sandbox Code Playgroud)

node.js cors express

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

Spring Reactive MongoDB不保存文档

我正在尝试保存一个基本文档,但尽管已成功连接到 mongodb ......它似乎不想保存。

弹簧原木

2018-10-03 00:17:25.998  INFO 10713 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2018-10-03 00:17:26.049  INFO 10713 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-10-03 00:17:26.106  INFO 10713 --- [ctor-http-nio-1] r.ipc.netty.tcp.BlockingNettyContext     : Started HttpServer on /0:0:0:0:0:0:0:0:8080
2018-10-03 00:17:26.106  INFO 10713 --- [  restartedMain] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2018-10-03 00:17:26.112  INFO 10713 --- [  restartedMain] c.l.s.ServiceLegalApplicationKt          : Started ServiceLegalApplicationKt in 3.459 seconds (JVM running for 4.201) …
Run Code Online (Sandbox Code Playgroud)

spring mongodb kotlin spring-data-mongodb

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

Jest Spy 说函数未被调用

我可以知道函数sendResponse被调用,因为里面的 console.log 行sendResponse被执行了。然而,我的间谍说该sendResponse方法没有被调用。只是想知道我在这里做错了什么。

\n\n
import * as ExpressHelpers from \'./express-helper\';\n\ndescribe(\'sendResponse\', () => {\n    it(\'sends a 500 error response\', () => {\n        const sendResponseSpy = spyOn(ExpressHelpers, \'sendResponse\');\n        const mockResponse = () => {\n            const res: any = {};\n            res.status = jest.fn().mockReturnValue(res);\n            res.send = jest.fn().mockReturnValue(res);\n            return res;\n        };\n        const errorMsg = \'Server error msg\';\n        const res = mockResponse();\n        ExpressHelpers.sendServerError(errorMsg, res);\n        expect(sendResponseSpy).toHaveBeenCalled();\n    });\n});\n
Run Code Online (Sandbox Code Playgroud)\n\n
export function sendResponse(statusCode: HttpStatus, message: string, data: {}, response: Express.Response) {\n    const responseEntity: …
Run Code Online (Sandbox Code Playgroud)

javascript typescript jestjs

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

Google Cloud启动脚本未运行

启动脚本的行为不符合我的期望。

.sh在存储桶中有一个文件,并且包含一个startup-script-url带有值的meta标签gs://bucket-name/start-script.sh

[[0;32m  OK  [0m] Started Google Compute Engine Accounts Daemon.
         Starting Google Compute Engine Startup Scripts...
[[0;32m  OK  [0m] Started Google Compute Engine Shutdown Scripts.
[[0;32m  OK  [0m] Started Google Compute Engine Startup Scripts.
[[0;32m  OK  [0m] Started Docker Application Container Engine.
[[0;32m  OK  [0m] Started Wait for Google Container Registry (GCR) to be accessible.
[[0;32m  OK  [0m] Reached target Google Container Registry (GCR) is Online.
[[0;32m  OK  [0m] Started Containers on GCE Setup. …
Run Code Online (Sandbox Code Playgroud)

google-compute-engine google-cloud-platform

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

迭代数组最后会给出完整的项目数组

我试图迭代一组记录.但是,在迭代结束时,rails会显示完整的数组.

<%= @portfolio_item.technologies.each do |technology| %>
  <p><%= technology.name %></p>
<% end %>
Run Code Online (Sandbox Code Playgroud)

浏览器中显示的内容 在此输入图像描述

ruby ruby-on-rails

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

Terraform Cloud(即远程后端)TF_VAR_环境替换不起作用?

地形版本:0.12.24

这真的很奇怪,因为我TF_VAR_之前使用过替换语法并且效果很好。

提供商.tf

# Configure the AWS Provider
provider "aws" {
  version = "~> 2.0"
  region  = "ap-southeast-2"
  access_key = var.aws_access_key_id
  secret_key = var.aws_secret_access_key
}
Run Code Online (Sandbox Code Playgroud)

变量.tf

variable "aws_access_key_id" {
  description = "Access Key for AWS IAM User"
}

variable "aws_secret_access_key" {
  description = "Secret Access Key for AWS IAM User"
}

variable "terraform_cloud_token" {
  description = "Token used to log into Terraform Cloud via the CLI"
}
Run Code Online (Sandbox Code Playgroud)

terraform 云的backend.tf

terraform {
  backend "remote" {
    organization = …
Run Code Online (Sandbox Code Playgroud)

terraform

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

rails db:migrate in Procfile 导致应用程序在 Heroku 中崩溃

当我包含web: rails:db:migrate在我的 Procfile 中时,它会使我的 rails 应用程序崩溃。当我rails db:migrate通过浏览器使用 Heroku 控制台运行时,它工作得很好。

2018-01-20T08:01:30.465226+00:00 heroku[web.1]: Starting process with command `rails db:migrate`

2018-01-20T08:01:34.612837+00:00 app[web.1]: I, [2018-01-20T08:01:34.206214 #4]  INFO -- : [SKYLIGHT] [1.5.0] Skylight agent enabled

2018-01-20T08:01:34.612854+00:00 app[web.1]: D, [2018-01-20T08:01:34.576132 #4] DEBUG -- :   [1m[35m (1.0ms)[0m  [1m[34mSELECT pg_try_advisory_lock(8624398319468495445)[0m

2018-01-20T08:01:34.612855+00:00 app[web.1]: D, [2018-01-20T08:01:34.589800 #4] DEBUG -- :   [1m[35m (1.5ms)[0m  [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m

2018-01-20T08:01:34.612857+00:00 app[web.1]: D, [2018-01-20T08:01:34.597079 #4] DEBUG -- :   [1m[36mActiveRecord::InternalMetadata Load (1.2ms)[0m  [1m[34mSELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails heroku

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

为 Pod 和服务配置 Terraform GKE 插件 IP 范围

我正在尝试使用GKE 的 Terraform 模块,但我不确定如何配置属性ip_range_podsip_range_services.

具体来说,我不确定他们是如何得出这些值的:

  ip_range_pods              = "us-central1-01-gke-01-pods"
  ip_range_services          = "us-central1-01-gke-01-services"
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-kubernetes-engine terraform

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