怎样安装webtodesk

2022年10月15日 | 分类: 【源码】

【介绍】

购买:https://codecanyon.net/item/webtodesk-convert-your-website-to-a-native-desktop-application/26454750
下载:https://nulljungle.com/2022-03-08/webtodesk-convert-your-website-to-a-native-desktop-application-2/

【安装】

按照 Documentation/index.html

上传代码到服务器任何目录。

配置参数:

config.js – Application configuration file. (Application Name, URL, application window sizes and more.)
package.json – NodeJS application and package details.

安装 Node.js 最新版本:

参考:https://amon.org/nodejs

apt install npm

安装打包工具:

进入代码目录。

执行:

npm install

执行:

npm start

报错: ⨯ Cannot find module ‘dmg-license’

执行:

yarn add electron-builder --dev

报错:

Command 'yarn' not found, but can be installed with:
apt install cmdtest

执行:

apt install cmdtest

再次执行:

yarn add electron-builder --dev

报错:yarn: error: no such option: –dev

卸载 cmdtest:

sudo apt remove cmdtest

重新安装 yarn:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

参考:https://stackoverflow.com/questions/53471063/yarn-error-there-are-no-scenarios-must-have-at-least-one
参考:https://blog.csdn.net/ghl2115/article/details/106683429

执行命令安装 electron-builder :

npm i electron-builder -g

参考:https://www.electronjs.org/docs/latest/tutorial/distribution-overview

执行命令生成 Linux 下安装包:

electron-builder --linux

报错:Error: Cannot find module ‘fs/promises’

参考:https://blog.csdn.net/qq_34617629/article/details/126059653

分析,原因是Node.js版本太低导致的。升级Node.js版本。

nvm install v18.11.0

重新执行命令。在 dist 目录下成功生成 Linux 下 .snap 和 .appimage 两种安装包。

参考:https://blog.csdn.net/aboutmn/article/details/87254930
参考:https://blog.csdn.net/u013670453/article/details/115406804

在Ubuntu 桌面测试安装 .snap 安装包:

sudo snap install WhoisDog_2.0.0_amd64.snap

报错:error: cannot find signatures with metadata for snap “WhoisDog_2.0.0_amd64.snap”

错误:无法找到包含元数据的签名

因为此软件没有经过SnapStore签名,需要加上–dangerous选项,即可安装,正常运行。

sudo snap install WhoisDog_2.0.0_amd64.snap --dangerous

安装成功,输出:

whoisdog 2.0.0 installed

在 Ubuntu 桌面上,开启一个终端,在命令行中输入:

whoisdog

WhoisDog 桌面程序即启动。

执行命令生成 Windows 下安装包:

sudo electron-builder --win

报错:⨯ wine is required, please see https://electron.build/multi-platform-build#linux

参考:https://blog.csdn.net/zmkzmkok/article/details/115003551
参考:https://github.com/electron-userland/electron-builder/issues/5665

执行命令安装 wine:

sudo apt install wine

重新执行打包命令。

报错:⨯ cannot execute cause=exit status 123 errorOut=it looks like wine32 is missing, you should install it.

参考:https://blog.csdn.net/weixin_44114370/article/details/89297884

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install win32

报错:E: Unable to locate package win32

参考:https://itsfoss.com/unable-to-locate-package-error-ubuntu/

参考:https://blog.csdn.net/qq_37435462/article/details/111769883

64位Linux一般会自带一个Wine,名字是wine64,注意Wine32安装之后的名字是wine而非wine32。

既然 wine 都已经安装了,肯定没包名为 win32…

报错:Error: Cannot find module ‘fs/promises’

参考:https://stackoverflow.com/questions/68085375/cannot-find-module-fs-promises-electron-js
参考:https://blog.csdn.net/gongwei628/article/details/118991735

执行命令生成 Mac 下安装包:

electron-builder --mac

报错: ⨯ Cannot find module ‘dmg-license’

参考:https://github.com/electron-userland/electron-builder/issues/6520
参考:https://npmmirror.com/package/dmg-license#installation

执行命令生成多个平台下安装包:

electron-builder -mwl

报错: ⨯ Cannot find module ‘dmg-license’

安装 dmg-license :

npm install --global dmg-license --no-optional

报错:

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-10-15T19_22_49_394Z-debug.log

参考:https://www.likecs.com/ask-3525021.html
参考:https://stackoverflow.com/questions/68085375/cannot-find-module-fs-promises-electron-js

此模块不支持 Linux ?

参考:https://github.com/oldj/SwitchHosts/issues/686

此模块还真不支持 Linux 。dmg-license 应该是在 macOS 下打包用的。