小编Sim*_*mon的帖子

从 Angular 7 更新到 8 后,“无法读取未定义属性‘地图’中的错误”

从 Angular 7 升级到 8 后,我遇到了一个奇怪的错误。每次我用 npm start 启动程序时,都会发生以下错误:“无法读取未定义属性‘地图’中的错误”。

控制台上没有更多信息,所以我找不到原因所在。因此,我试图在我的代码中注释掉 .map 的每一次出现。不幸的是,发生了同样的错误。此外,我更新了所有依赖项,但没有任何效果。

从 7 升级到 8 后有没有其他人遇到过类似的问题?我的 package.json 看起来像这样:

  "name": "test",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.14",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/flex-layout": "^8.0.0-beta.27",
    "@angular/forms": "~8.2.14",
    "@angular/material": "^7.3.7",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "~8.2.14",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "apollo-angular": "^1.8.0",
    "apollo-angular-link-http": "^1.9.0",
    "apollo-cache-inmemory": "^1.6.5",
    "apollo-client": …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

如何构建JavaScript ANTLR访问者

我实际上在JavaScript中实现了一个antlr-visitor有一个问题.我已经创建了一个语法.但是,我没有找到任何文档,示例或教程.不知何故,只返回多维数组.在那里发生了类似的问题:https://github.com/antlr/antlr4/issues/1995 不幸的是,在这个讨论中没有解决方案.在Java中,我已经有一个完成的访问者,因此只想将其转换为JS.所以我更愿意,如果有一个没有听众的解决方案.在此先感谢您的帮助

编辑:这是访问者,语法和起始工具的代码.

const antlr4 = require('antlr4');
const grammarLexer = require('./SimpleGrammarLexer');
const grammarParser = require('./SimpleGrammarParser');
const extendGrammarVisitor = require('./ExtendGrammarVisitor.js');

export class SimpleGrammar {
    public static parseCode(formula: string) {
        const inputStream = new antlr4.InputStream(formula);
        const lexer = new grammarLexer.SimpleGrammarLexer(inputStream);
        const commonTokenStream = new antlr4.CommonTokenStream(lexer);
        const parser = new grammarParser.SimpleGrammarParser(commonTokenStream);
        const visitor = new extendGrammarVisitor.ExtendGrammarVisitor();
        const parseTree = parser.r();
        visitor.visitR(parseTree);
    }
}
Run Code Online (Sandbox Code Playgroud)


grammar SimpleGrammar;
r: input;
INT    : [0-9]+;
DOUBLE : [0-9]+'.'[0-9]+;
PI     : 'pi';
E      : 'e';
POW …
Run Code Online (Sandbox Code Playgroud)

javascript antlr4

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

如何在 JavaScript 中将 Decimal128 值转换为数字?

我正在从 MongoDB 数据库(MongoDB Driver 3.3)查询数据。有些值以格式存储Decimal128。问题是返回以下对象而不是数字:

value: Decimal128 {
  _bsontype: 'Decimal128',
  bytes: <Buffer 80 7c 45 c7 c6 02 00 00 00 00 00 00 00 00 3e 30>
}
Run Code Online (Sandbox Code Playgroud)

我发现没有函数可以将此对象转换为人类可读的数字(本机 JavaScript 64 位数字)。有人知道如何实现这一目标吗?

javascript mongodb

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

spring boot连接mongoDB出现错误

我想在 Spring Boot 项目中连接 mongoDB Atlas,但总是抛出异常。如果我在没有 Spring Boot 的情况下使用 Java,则一切正常。以下测试项目重现了错误。pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maven-test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>


<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.1.RELEASE</version>
    <relativePath />
</parent>

<properties>
    <java.version>1.8</java.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

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

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-sync</artifactId>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-core</artifactId>
    </dependency>

</dependencies>

</project>
Run Code Online (Sandbox Code Playgroud)

主班:

package test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;

@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class})
public class …
Run Code Online (Sandbox Code Playgroud)

java spring mongodb spring-boot

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

标签 统计

javascript ×2

mongodb ×2

angular ×1

antlr4 ×1

java ×1

spring ×1

spring-boot ×1

typescript ×1