我依据 开发环境搭建 - 1Panel 文档运行1panel 源码,出现如下问题:
- 后端:我直接在1Panel-1.10.2-lts\cmd\server目录下执行go build(go1.22.2.windows-amd64)会出现:
>go build
# github.com/1Panel-dev/1Panel/backend/utils/files
..\..\backend\utils\files\fileinfo.go:87:47: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:88:61: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:89:61: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:90:44: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:272:46: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:273:43: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:274:60: undefined: syscall.Stat_t
..\..\backend\utils\files\fileinfo.go:275:60: undefined: syscall.Stat_t
# github.com/1Panel-dev/1Panel/backend/utils/terminal
..\..\backend\utils\terminal\local_cmd.go:76:11: undefined: syscall.SYS_IOCTL
..\..\backend\utils\terminal\local_cmd.go:78:11: undefined: syscall.TIOCSWINSZ
..\..\backend\utils\terminal\local_cmd.go:79:3: not enough arguments in call to syscall.Syscall
have (unknown type, uintptr, unknown type, uintptr)
want (uintptr, uintptr, uintptr, uintptr, uintptr)
2.前端:在1Panel-1.10.2-lts\frontend目录中运行出现:
>node -v
v20.12.2;
>npm -v
10.5.0
>npm run dev
> 1Panel-Frontend@1.7 dev
> vite
Port 4004 is in use, trying another one...
vite v2.9.18 dev server running at:
> Network: http://192.168.1.28:4005/
> Network: http://192.168.80.1:4005/
> Network: http://192.168.84.1:4005/
> Local: http://localhost:4005/
ready in 3222ms.
files in the public directory are served at the root path.
Instead of /public/favicon.png, use /favicon.png.
15:25:27 [vite] http proxy error:
AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1116:18)
at afterConnectMultiple (node:net:1683:7)
15:25:27 [vite] http proxy error:
AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1116:18)
at afterConnectMultiple (node:net:1683:7) (x2)
15:25:27 [vite] http proxy error:
AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1116:18)
at afterConnectMultiple (node:net:1683:7) (x3)
15:25:27 [vite] http proxy error:
AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1116:18)
at afterConnectMultiple (node:net:1683:7) (x4)
我想知道该如何才能正确从源码中运行1panel,我无法从说明文档中的开发环境成功运行,也无法在vscode中成功运行,希望能得到大家的帮助,谢谢
windows 开发会有这个问题,建议使用 linux
GOROOT=C:\Users\l****\go\go1.21.0 #gosetup
GOPATH=C:\Users*\go #gosetup
C:\Users*\go\go1.21.0\bin\go.exe build -o C:\Users****\AppData\Local\JetBrains\GoLand2024.1\tmp\GoLand___go_build_github_com_1Panel_dev_1Panel_cmd_server.exe github.com/1Panel-dev/1Panel/cmd/server #gosetup
…..\backend\utils\files\fileinfo.go:87:47: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:88:61: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:89:61: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:90:44: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:272:46: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:273:43: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:274:60: undefined: syscall.Stat_t
…..\backend\utils\files\fileinfo.go:275:60: undefined: syscall.Stat_t
githubcom/1Panel-dev/1Panel/backend/utils/terminal
…..\backend\utils\terminal\local_cmd.go:62:2: window declared and not used
…..\backend\utils\terminal\local_cmd.go:74:5: undefined: errno
…..\backend\utils\terminal\local_cmd.go:75:10: undefined: errno
编译完成,并显示退出代码 1
相同问题 go后端启动报错
可以后端扔到 linux 服务器,然后配置上go 环境,远程开发后端,然后本地跑前端
我使用ubuntu在cmd/server中执行go build 得到server可执行文件,并执行./server得到如下结果
[2024-04-22 02:46:46] [INFO] init logger successfully
[2024-04-22 02:46:46] [INFO] init monitor db successfully
[2024-04-22 02:46:46] [INFO] init db successfully
[2024-04-22 02:46:46] [INFO] Migration run successfully
之后,我在Ubuntu的frontend目录下,使用 npm run dev 启动前端代码,访问http://192.168.1.27:4004/,一直处于加载界面,代码提示如下
npm run dev
> 1Panel-Frontend@1.7 dev
> vite
vite v2.9.18 dev server running at:
> Local: http://localhost:4004/
> Network: http://192.168.1.27:4004/
ready in 1290ms.
2:49:21 AM [vite] ✨ new dependencies optimized: element-plus/es, element-plus/es/components/base/style/index, element-plus/es/components/config-provider/style/index, element-plus/es/components/divider/style/index, element-plus/es/components/card/style/index, ...and 15 more
2:49:21 AM [vite] ✨ optimized dependencies changed. reloading
2:49:59 AM [vite] ✨ new dependencies optimized: element-plus/es/components/checkbox/style/index, element-plus/es/components/dropdown/style/index, element-plus/es/components/dropdown-menu/style/index, element-plus/es/components/dropdown-item/style/index, element-plus/es/components/form/style/index, ...and 2 more
2:49:59 AM [vite] ✨ optimized dependencies changed. reloading
2:50:17 AM [vite] http proxy error:
Error: connect ECONNREFUSED 127.0.0.1:9999
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1571:16)