在运行Tauri应用程序时,它只显示一个白色屏幕,如下所示:
我没有对这个应用程序做任何修改。
下面是我创建这个应用程序的方式:
npx create-tauri-app
然后我选择了React作为我的前端框架。
然后它创建了应用程序,我只把cd放到文件夹中,运行npm运行tauri
下面是我的Tauri配置json文件:
{
"$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
}
]
}
}
发布于 2022-06-14 11:29:26
如果您仍然有此问题(或如果其他人有此问题),我也有同样的问题,原来3000端口已经在我的系统上使用了。
要查找正在使用端口的内容:
Windows:netstat -ab
OSX:lsof -nP -iTCP -sTCP:LISTEN | grep 3000
如果你想换港口的话。),更新src-tauri/tauri.conf.json
,使其具有以下内容:
...
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev -- --port 4000",
"devPath": "http://localhost:4000",
"distDir": "../dist"
},
...
希望这能有所帮助。
https://stackoverflow.com/questions/72336875
复制相似问题