8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

gnome shell 扩展中出现“参数‘域’的预期类型字符串,但类型未定义”错误

Harley 2月前

50 0

我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extensionUbuntu 22.04、GNOME 42.9、waylandcontents 扩展...

我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extension Ubuntu 22.04、GNOME 42.9、wayland

extension.js 的内容(从上面的链接复制):

const St = imports.gi.St;

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;

const {
gettext: _,
} = ExtensionUtils;


class Extension {
enable() {
    // Create a panel button
    this._indicator = new PanelMenu.Button(0.0, Me.metadata.name, false);

    // Add an icon
    const icon = new St.Icon({
        icon_name: 'face-laugh-symbolic',
        style_class: 'system-status-icon',
    });
    this._indicator.add_child(icon);

    // Add the indicator to the panel
    Main.panel.addToStatusArea(Me.metadata.uuid, this._indicator);

    // Add a menu item to open the preferences window
    this._indicator.menu.addAction(_('Preferences'),
        () => ExtensionUtils.openPrefs());

    this._count = 0;
}

disable() {
    if (this._indicator) {
        this._indicator.destroy();
        this._indicator = null;
    }
}
}


function init() {
ExtensionUtils.initTranslations();

return new Extension();
}

metadata.json的内容:

{
"uuid": "[email protected]",
"name": "Example Extension",
"description": "An example extension",
"shell-version": [ "42.9" ],
"url": "https://gjs.guide/extensions"
}

错误:

enter image description here

帖子版权声明 1、本帖标题:gnome shell 扩展中出现“参数‘域’的预期类型字符串,但类型未定义”错误
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Harley在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 您在调用时 Extension.initTranslations() 没有使用 gettext 域,扩展程序中也没有任何翻译。删除该调用应该可以修复出现的错误。

  • 我有一个 shell 脚本来监控系统资源使用情况并发送警报。基本上,它依赖于以下命令:ps -u \'$user\' --no-headers -o pmem | awk '{sum += $1} END {print su...

    我有一个 shell 脚本来监控系统资源使用情况并发送警报。基本上,它依赖于以下命令:

    ps -u "$user" --no-headers -o pmem | awk '{sum += $1} END {print sum}'
    

    在大多数情况下,它运行良好,但最近我注意到了一些问题。

    例如,使用干净的重新启动系统运行以最大限度地减少其他进程的影响:

    # R
    library(data.table)
    library(parallel)
    
    set.seed(123)
    n_rows <- 1e7  
    n_cols <- 1000
    ## memory black hole!!! change it if necessary, however, you need to require a high level of memory usage (about 1/30 to 1/10 of your usable memory) to achieve significant results in the subsequent tests
    dt <- data.table(matrix(runif(n_rows * n_cols), nrow = n_rows, ncol = n_cols))
    
    memory_usage <- object.size(dt)
    format(memory_usage, units = "auto")
    
    worker_function <- function(data) {
      row_sums <- rowSums(data)
      ## wait about 30s and run shell command to test when process sleep
      Sys.sleep(1000)
      return(row_sums)
    }
    
    n_threads <- 10
    results <- mclapply(1:n_threads, function(x) worker_function(dt), mc.cores = n_threads)
    

    通过top检查内存状态

    top
    

    enter image description here

    我们可以通过 MEM% 列的总和来获取内存使用率百分比,或者通过以下命令:

    ps -u "$user" --no-headers -o pmem | awk '{sum += $1} END {print sum}'
    # 113.9
    

    在我的系统(1.5 TiB 内存和 2.0 GiB 交换空间)中,您会发现这个值大于 100,但如果您通过 检查内存 free -h ,您会得到:

    enter image description here

    仅使用 645/1500 Gib,不到 50%

  • 在不同的程序(top、free、htop、ps 等)中,这永远不会是一个准确的数字(分配、释放、垃圾收集等),但也许可以看到

  • Kai 2月前 0 只看Ta
    引用 5

    按照以下步骤 https://github.com/google/android-cuttlefish/blob/main/docker/README.md 构建 Docker 镜像以在 Ubuntu 23.10 主机上运行 Cuttlefish 会产生以下输出和

    按照以下步骤 https://github.com/google/android-cuttlefish/blob/main/docker/README.md 构建 Docker 镜像以在 Ubuntu 23.10 主机上运行 Cuttlefish,运行后会出现以下输出和错误 ./build.sh :

    
    ###
    ### Building docker image
    ###
    [+] Building 53.1s (13/20)                                                                                                                     docker:default
     => [internal] load build definition from Dockerfile                                                                                                     0.0s
     => => transferring dockerfile: 4.37kB                                                                                                                   0.0s
     => [internal] load metadata for docker.io/library/debian:stable-20211011                                                                                0.2s
     => [internal] load .dockerignore                                                                                                                        0.0s
     => => transferring context: 2B                                                                                                                          0.0s
     => [cuttlefish-softgpu  1/16] FROM docker.io/library/debian:stable-20211011@sha256:9de81807d160cd87c476ffe90215d85478d1d2e2c1d4973b54d993a34d3986de     0.0s
     => [internal] load build context                                                                                                                        0.0s
     => => transferring context: 89B                                                                                                                         0.0s
     => CACHED [cuttlefish-softgpu  2/16] WORKDIR /root                                                                                                      0.0s
     => [cuttlefish-softgpu  3/16] RUN set -x                                                                                                                0.5s
     => [cuttlefish-softgpu  4/16] RUN apt-get update     && apt-get install --no-install-recommends -y systemd     && apt-get clean     && rm -rf /var/lib  7.6s
     => [cuttlefish-softgpu  5/16] RUN rm -f /lib/systemd/system/multi-user.target.wants/*     /etc/systemd/system/*.wants/*     /lib/systemd/system/local-  0.3s
     => [cuttlefish-softgpu  6/16] RUN apt-get update     && apt-get install --no-install-recommends -y apt-utils sudo vim gawk coreutils        openssh-s  43.6s 
     => [cuttlefish-softgpu  7/16] RUN if test $(uname -m) == aarch64; then      dpkg --add-architecture amd64      && apt-get update      && apt-get insta  0.2s 
     => [cuttlefish-softgpu  8/16] COPY ./out/*.deb ./android-cuttlefish/out/                                                                                0.2s 
     => ERROR [cuttlefish-softgpu  9/16] RUN cd /root/android-cuttlefish/out     && apt-get install --no-install-recommends -y -f ./cuttlefish-base_*.deb    0.5s 
    ------                                                                                                                                                        
     > [cuttlefish-softgpu  9/16] RUN cd /root/android-cuttlefish/out     && apt-get install --no-install-recommends -y -f ./cuttlefish-base_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-user_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-common_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-orchestration_*.deb     && rm -rvf ./cuttlefish-base_*.deb     && rm -rvf ./cuttlefish-user_*.deb     && rm -rvf ./cuttlefish-common_*.deb     && rm -rvf ./cuttlefish-orchestration_*.deb     && cd /root:
    0.260 Reading package lists...
    0.497 E: Unsupported file ./cuttlefish-base_*.deb given on commandline
    ------
    Dockerfile:56
    --------------------
      55 |     
      56 | >>> RUN cd /root/android-cuttlefish/out \
      57 | >>>     && apt-get install --no-install-recommends -y -f ./cuttlefish-base_*.deb \
      58 | >>>     && apt-get install --no-install-recommends -y -f ./cuttlefish-user_*.deb \
      59 | >>>     && apt-get install --no-install-recommends -y -f ./cuttlefish-common_*.deb \
      60 | >>>     && apt-get install --no-install-recommends -y -f ./cuttlefish-orchestration_*.deb \
      61 | >>>     && rm -rvf ./cuttlefish-base_*.deb \
      62 | >>>     && rm -rvf ./cuttlefish-user_*.deb \
      63 | >>>     && rm -rvf ./cuttlefish-common_*.deb \
      64 | >>>     && rm -rvf ./cuttlefish-orchestration_*.deb \
      65 | >>>     && cd /root
      66 |     
    --------------------
    ERROR: failed to solve: process "/bin/bash -c cd /root/android-cuttlefish/out     && apt-get install --no-install-recommends -y -f ./cuttlefish-base_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-user_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-common_*.deb     && apt-get install --no-install-recommends -y -f ./cuttlefish-orchestration_*.deb     && rm -rvf ./cuttlefish-base_*.deb     && rm -rvf ./cuttlefish-user_*.deb     && rm -rvf ./cuttlefish-common_*.deb     && rm -rvf ./cuttlefish-orchestration_*.deb     && cd /root" did not complete successfully: exit code: 100
    

    我尝试使用精确的文件名,但仍然失败,所以这不是通配符的问题。

  • 看起来 Docker 容器不再受支持,因为它已在此提交中删除: https://github.com/google/android-cuttlefish/commit/387dd28fe40d8fd217b363aa95f3b326af2342e7

  • 我正在开展一个项目,需要使用 SSM 文档将 Spring Boot 应用程序 Pet Clinic 安装到 Ubuntu 22 服务器上。我已附加 Systems Manager 运行文档。错误是...

    我正在开展一个项目,需要使用 SSM 文档将 Spring Boot 应用程序 Pet Clinic 到 Ubuntu 22 服务器上。我已附加 Systems Manager 运行文档。以下错误来自命令 sudo journalctl -u spring-petclinic.service 。我尝试授予任何和所有访问权限,以 root 身份运行,但仍然不起作用。

    关于如何让该应用程序保持运行,您有什么想法吗?

    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Failed with result 'exit-code'.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Scheduled restart job, restart counter is at 3.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: Stopped Spring PetClinic Application.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: Started Spring PetClinic Application.
    May 17 21:52:36 ip-10-0-4-141 java[7076]: Error: Unable to access jarfile /clinic/spring-petclinic/target/*.jar
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Main process exited, code=exited, status=1/FAILURE
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Failed with result 'exit-code'.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Scheduled restart job, restart counter is at 4.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: Stopped Spring PetClinic Application.
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: Started Spring PetClinic Application.
    May 17 21:52:36 ip-10-0-4-141 java[7077]: Error: Unable to access jarfile /clinic/spring-petclinic/target/*.jar
    May 17 21:52:36 ip-10-0-4-141 systemd[1]: spring-petclinic.service: Main process exited, code=exited, status=1/FA
    
    ---
    schemaVersion: '2.2'
    description: Install Java 17 and run the Spring PetClinic application
    parameters: {}
    mainSteps:
    - name: InstallJava17
      action: aws:runShellScript
      inputs:
        runCommand:
        - |
          #!/bin/bash
          
          # Check if Java is installed
          if java -version > /dev/null 2>&1; then
            echo "Java is installed. No need to restart"
          else
            echo "Java is not installed. Restarting after install...."
            # Update package lists
            sudo apt-get update
            
            # Install OpenJDK 17
            sudo apt-get install -y openjdk-17-jdk
              
            # Verify Java installation
            java -version
    
            exit 194
          fi
          
    - name: DownloadApplication
      action: aws:runShellScript
      inputs:
        runCommand:
        - |
          #!/bin/bash
          
          # clean the environment file
          cat /dev/null > /etc/environment
          
          # set the full path
          echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:\$JAVA_HOME/bin\"" | sudo tee -a /etc/environment
          
          # grab the java home and set it in the environment
          JAVA_HOME=$(sudo update-alternatives --config java | grep -o -E '/usr/lib/jvm/[a-zA-Z0-9-]+') 
          echo "JAVA_HOME=\"$JAVA_HOME\"" | sudo tee -a /etc/environment
          
          # update the variables
          source /etc/environment
            
          echo "whoami?"
          sudo whoami
          
          # Create and move into new folder
          sudo mkdir /clinic
          cd /clinic
          
          # Download the repository
          echo "# Download the repository"
          sudo git clone https://github.com/spring-projects/spring-petclinic.git
          
          # Move into the folder
          echo "# Move into the folder"
          cd spring-petclinic
          
          # Start the Maven build
          echo "# Start the Maven build"
          ./mvnw package
          
    - name: CreateSystemdService
      action: aws:runShellScript
      inputs:
        runCommand:
        - |
          #!/bin/bash
          
          # clean the environment file
          cat /dev/null > /etc/environment
          
          # set the full path
          echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:\$JAVA_HOME/bin\"" | sudo tee -a /etc/environment
          
          # grab the java home and set it in the environment
          JAVA_HOME=$(sudo update-alternatives --config java | grep -o -E '/usr/lib/jvm/[a-zA-Z0-9-]+') 
          echo "JAVA_HOME=\"$JAVA_HOME\"" | sudo tee -a /etc/environment
          
          # update the variables
          source /etc/environment
          
          # Create systemd service unit
          echo "# Create systemd service unit"
          sudo tee /etc/systemd/system/spring-petclinic.service <<EOF
          [Unit]
          Description=Spring PetClinic Application
          After=network.target
          
          echo "THIS IS THE PATH"
          echo $PATH
          
          echo "THIS IS THE JAVA_HOME"
          echo $JAVA_HOME
          
          [Service]
          ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /clinic/spring-petclinic/target/*.jar
          Restart=always
          User=root
          
          [Install]
          WantedBy=multi-user.target
          EOF
          
          echo "whoami?"
          sudo whoami
          
          # Reload systemd and start the service
          echo "# Reload systemd and start the service"
          
          echo "whoami?"
          sudo whoami
    
          echo "daemon is reloading"
          sudo systemctl daemon-reload
          
          echo "whoami?"
          sudo whoami
          
          echo "enabling spring-petclinic"
          sudo systemctl enable spring-petclinic
          
          echo "whoami?"
          sudo whoami
          
          echo "starting spring-petclinic"
          sudo systemctl start spring-petclinic
    
  • 我认为问题出在这一行:

    ExecStart=/usr/lib/jvm/java-17-openjdk-amd64/bin/java 
              -jar /clinic/spring-petclinic/target/*.jar
    

    (为了易读,我把它拆分了。)

    让我们开始吧:

    java -jar /clinic/spring-petclinic/target/*.jar
    

    -jar 选项需要一个 JAR 文件。但从表面上看,它 * 可以扩展为多个 JAR 的路径名。这行不通。第二个和后续 JAR作为命令行参数传递;即在 \'arg list\' 中。而且它们不会在类路径上。

    此外,如果您的应用程序确实由多个 JAR 文件组成,则该 -jar 选项不是运行它的正确方法。相反,您需要指定类路径(例如使用参数 -cp )并提供入口点类名。它看起来像这样:

    java -cp /somepath/part1.jar:/somepath/part2.jar com.example.FooCommand ...
    

    (也可以在类路径中使用通配符,但是 Java 有特定的语法来执行此操作。请查看 java 您的 Java 版本的命令手册条目。)


    但实际解释比这更简单。那里的文件是 systemd 单元配置文件;请参阅 https://www.freedesktop.org/software/systemd/man/255/systemd.service.html 。手册条目解释说 ExecStart 字符串不是完整的 shell 语法。支持 shell 语法的某些方面,但 * 不支持通配符。(有关 systemd.service 详细信息,请参阅手册条目。)

    因此...您 ExecStart 指定的是 * 路径名中包含文字字符的 JAR 文件。显然,它不存在; java 命令错误消息告诉您这一点。

  • 亲爱的上帝,我简直不敢相信事情竟然这么简单。我花了这么多周期才搞定!非常感谢您的解释。我从来没有在服务器上启动过 Java 应用程序,尽管我在服务器上开发了好几年。非常感谢您为此付出的时间和精力。

返回
作者最近主题: