首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当我运行应用程序时,Tauri应用程序显示了白色屏幕。

当我运行应用程序时,Tauri应用程序显示了白色屏幕。
EN

Stack Overflow用户
提问于 2022-05-22 10:48:23
回答 1查看 578关注 0票数 3

在运行Tauri应用程序时,它只显示一个白色屏幕,如下所示:

我没有对这个应用程序做任何修改。

下面是我创建这个应用程序的方式:

npx create-tauri-app

然后我选择了React作为我的前端框架。

然后它创建了应用程序,我只把cd放到文件夹中,运行npm运行tauri

下面是我的Tauri配置json文件:

代码语言:javascript
运行
复制
{
  "$schema": "..\\node_modules/@tauri-apps/cli\\schema.json",
  "build": {
    "beforeBuildCommand": "npm run build",
    "beforeDevCommand": "npm run start",
    "devPath": "http://localhost:3000",
    "distDir": "../build"
  },
  "package": {
    "productName": "test",
    "version": "0.1.0"
  },
  "tauri": {
    "allowlist": {
      "all": true
    },
    "bundle": {
      "active": true,
      "category": "DeveloperTool",
      "copyright": "",
      "deb": {
        "depends": []
      },
      "externalBin": [],
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "identifier": "com.tauri.dev",
      "longDescription": "",
      "macOS": {
        "entitlements": null,
        "exceptionDomain": "",
        "frameworks": [],
        "providerShortName": null,
        "signingIdentity": null
      },
      "resources": [],
      "shortDescription": "",
      "targets": "all",
      "windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": ""
      }
    },
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "test",
        "width": 800
      }
    ]
  }
}
EN

回答 1

Stack Overflow用户

发布于 2022-06-14 11:29:26

如果您仍然有此问题(或如果其他人有此问题),我也有同样的问题,原来3000端口已经在我的系统上使用了。

要查找正在使用端口的内容:

Windows:netstat -ab

OSX:lsof -nP -iTCP -sTCP:LISTEN | grep 3000

如果你想换港口的话。),更新src-tauri/tauri.conf.json,使其具有以下内容:

代码语言:javascript
运行
复制
...
"build": {
    "beforeBuildCommand": "npm run build",
    "beforeDevCommand": "npm run dev -- --port 4000",
    "devPath": "http://localhost:4000",
    "distDir": "../dist"
},
...

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72336875

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档