Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wox not starting in dev mode #4015

Open
2 of 5 tasks
SashvDave opened this issue Apr 28, 2024 · 23 comments
Open
2 of 5 tasks

Wox not starting in dev mode #4015

SashvDave opened this issue Apr 28, 2024 · 23 comments
Assignees

Comments

@SashvDave
Copy link

Version

  • v1 (has no resource to fix)
  • v2

Platform

  • Macos
  • Windows
  • Linux

Description

I clone the wox repository and run just dev after installing all necessary packages as outlined in the ReadMe. However, when I run justDev, the last thing that pops up is "Building macOS application..." and then it just terminates.

Log

please upload wox log to help identify your bug.

  • ~/.wox/log/log if you use macos or linux
  • C:\Users\<yourname>\.wox\log\log if you use windows
@qianlifeng
Copy link
Member

Can you copy the full output of the just dev here? thx.

@SashvDave
Copy link
Author

yes, here's the output:

`Wox on  v2 [!?]
➜ just dev
==> Downloading https://formulae.brew.sh/api/formula.jws.json
####################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
####################################################################################################################################### 100.0%
Warning: lefthook 1.6.10 is already installed and up-to-date.
To reinstall 1.6.10, run:
brew reinstall lefthook
sync hooks: ✔️ (pre-commit)
running nodejs host
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 759ms

wox-plugin-host-nodejs@1.0.0 build /Users/sashvdave/Wox/Wox.Plugin.Host.Nodejs
pnpm clean && ncc build src/index.ts -o dist && babel dist --out-dir dist

wox-plugin-host-nodejs@1.0.0 clean /Users/sashvdave/Wox/Wox.Plugin.Host.Nodejs
node -e "var { rmdirSync, existsSync } = require('fs'), path = require('path'); ['./dist'].forEach(fPath => {if (existsSync(path.join(__dirname, fPath))) rmdirSync(path.join(__dirname, fPath), { recursive: true })}); process.exit(0);"

ncc: Version 0.38.0
ncc: Compiling file index.js into CJS
ncc: Using typescript@5.2.2 (local user-provided)
800kB dist/index.js
800kB [2174ms] - ncc 0.38.0
[BABEL] Note: The code generator has deoptimised the styling of /Users/sashvdave/Wox/Wox.Plugin.Host.Nodejs/dist/index.js as it exceeds the max of 500KB.
Successfully compiled 1 file with Babel (1892ms).
running python host
Collecting loguru==0.7.2 (from -r requirements.txt (line 1))
Using cached loguru-0.7.2-py3-none-any.whl.metadata (23 kB)
Collecting websockets==11.0.3 (from -r requirements.txt (line 2))
Using cached websockets-11.0.3-py3-none-any.whl.metadata (6.6 kB)
Using cached loguru-0.7.2-py3-none-any.whl (62 kB)
Using cached websockets-11.0.3-py3-none-any.whl (118 kB)
Installing collected packages: websockets, loguru
Successfully installed loguru-0.7.2 websockets-11.0.3
running flutter command
Cleaning Xcode workspace... 4.0s
Deleting build... 1,064ms
Deleting .dart_tool... 251ms
Deleting ephemeral... 0ms
Deleting ephemeral... 1ms
Deleting ephemeral... 0ms
Deleting .flutter-plugins-dependencies... 0ms
Deleting .flutter-plugins... 0ms
Resolving dependencies...
cross_file 0.3.3+8 (0.3.4+1 available)
device_info_plus 9.1.2 (10.1.0 available)
ffi 2.1.0 (2.1.2 available)
file_picker 8.0.0+1 (8.0.3 available)
flutter_markdown 0.6.20 (0.7.1 available)
http 1.2.0 (1.2.1 available)
intl 0.18.1 (0.19.0 available)
leak_tracker 9.0.16 (10.0.5 available)
leak_tracker_testing 1.0.5 (3.0.1 available)
matcher 0.12.16 (0.12.16+1 available)
material_color_utilities 0.8.0 (0.11.1 available)
meta 1.11.0 (1.14.0 available)
path 1.8.3 (1.9.0 available)
test_api 0.6.1 (0.7.1 available)
url_launcher_web 2.2.3 (2.3.1 available)
vm_service 13.0.0 (14.2.1 available)
web 0.4.0 (0.5.1 available)
web_socket_channel 2.4.3 (2.4.5 available)
win32 5.2.0 (5.5.0 available)
win32_registry 1.1.2 (1.1.3 available)
Got dependencies!
20 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.

Running pod install... 2,691ms
2024-04-28 20:25:12.677 xcodebuild[16349:109358] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:206A85A5-653A-5085-A316-792A58956ACC }
{ platform:macOS, arch:arm64, id:206A85A5-653A-5085-A316-792A58956ACC }
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
Building macOS application... `

@qianlifeng
Copy link
Member

It will take about 1 minute for Building macos appliation..., how long have you waited in this phrase?

@SashvDave
Copy link
Author

well it just stops afterwards. Like it stops running. And I've run this 6 ot 7 times and everytime it just cuts the run with no error.

Screenshot 2024-04-28 at 8 52 06 PM

@SashvDave
Copy link
Author

If it's any help, here's my justfile:

`current_flutter_target := if os() == "windows" { "windows" } else if os() == "linux" { "linux" } else if os() == "macos" { "macos" } else { "unknown" }
python_command := if os() == "windows" { "python" } else { "python3" }

default:
@just --list --unsorted

@dev:
# make sure lefthook installed
go install github.com/evilmartians/lefthook@latest
brew install lefthook
lefthook install -f

just _build_hosts
just _build_flutter

@precommit:
cd Wox.UI.React && pnpm build && cd ..

@plugins:
# build plugins
#just _build_dev_nodejs_plugin Wox.Plugin.ProcessKiller ~/.wox/wox-user/plugins

just _build_dev_nodejs_plugin Wox.Plugin.ProcessKiller ~/icloud/wox/plugins
just _build_dev_nodejs_plugin_chatgpt Wox.Plugin.Chatgpt ~/icloud/wox/plugins

@ci_plugin:
cd ci && go run plugin.go

@Release target:
rm -rf Release
just _build_hosts
just _build_flutter

if [ "{{target}}" = "windows" ]; then \
  cd Wox && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags "-H windowsgui -s -w -X 'wox/util.ProdEnv=true'" -o ../Release/wox-windows-amd64.exe && cd ..; \
  upx --brute Release/wox-windows-amd64.exe; \
elif [ "{{target}}" = "linux" ]; then \
  cd Wox && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'wox/util.ProdEnv=true'" -o ../Release/wox-linux-amd64 && cd ..; \
  upx --brute Release/wox-linux-amd64; \
  chmod +x Release/wox-linux-amd64; \
elif [ "{{target}}" = "darwin-arm64" ]; then \
  cd Wox && CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" go build -ldflags "-s -w -X 'wox/util.ProdEnv=true'" -o ../Release/wox-mac-arm64 && cd ..; \
  just _bundle_mac_app wox-mac-arm64; \
elif [ "{{target}}" = "darwin-amd64" ]; then \
  cd Wox && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" go build -ldflags "-s -w -X 'wox/util.ProdEnv=true'" -o ../Release/wox-mac-amd64 && cd ..; \
  just _bundle_mac_app wox-mac-amd64; \
fi

@_bundle_mac_app name:
chmod +x Release/{{name}}

# bundle mac app, https://github.com/sindresorhus/create-dmg
cd Release && \
rm -rf {{name}}.app && \
rm -rf Wox.app && \
mkdir -p {{name}}.app/Contents/MacOS && \
mkdir -p {{name}}.app/Contents/Resources && \
cp {{name}} {{name}}.app/Contents/MacOS/wox && \
cp ../Assets/mac/Info.plist {{name}}.app/Contents/Info.plist && \
cp ../Assets/mac/app.icns {{name}}.app/Contents/Resources/app.icns && \
mv {{name}}.app Wox.app && \
create-dmg Wox.app && \
mv "Wox 2.0.0.dmg" {{name}}.dmg

@test:
just dev
cd Wox && go test ./...

@_build_dev_nodejs_plugin pluginName directory:
rm -rf {{directory}}/{{pluginName}}
cd Plugins/{{pluginName}} && pnpm install && pnpm run build && cd ..
mkdir -p {{directory}}/{{pluginName}}
cp -r Plugins/{{pluginName}}/dist/* {{directory}}/{{pluginName}}/
cp Plugins/{{pluginName}}/plugin.json {{directory}}/{{pluginName}}/plugin.json
cp -r Plugins/{{pluginName}}/images {{directory}}/{{pluginName}}/images

@_build_dev_nodejs_plugin_chatgpt pluginName directory:
rm -rf {{directory}}/{{pluginName}}
cd Plugins/{{pluginName}} && just build && cd ..
mkdir -p {{directory}}/{{pluginName}}
cp -r Plugins/{{pluginName}}/dist/* {{directory}}/{{pluginName}}/
cp Plugins/{{pluginName}}/Wox.Plugin.Chatgpt.Server/plugin.json {{directory}}/{{pluginName}}/plugin.json
cp -r Plugins/{{pluginName}}/Wox.Plugin.Chatgpt.Server/images {{directory}}/{{pluginName}}/images

@_build_hosts:
# build hosts
rm -rf Wox/resource/hosts
mkdir Wox/resource/hosts
just _build_nodejs_host Wox/resource/hosts
just _build_python_host Wox/resource/hosts

@_build_electron:
cd Wox.UI.React && pnpm install && pnpm build && cd ..

# electron
rm -rf Wox/resource/ui/electron
mkdir -p Wox/resource/ui/electron
cp Wox.UI.Electron/main.js Wox/resource/ui/electron/main.js
cp Wox.UI.Electron/preload.js Wox/resource/ui/electron/preload.js

@_build_nodejs_host directory:
echo "running nodejs host"
cd Wox.Plugin.Host.Nodejs && pnpm install && pnpm run build && cd ..
mkdir -p {{directory}}
cp Wox.Plugin.Host.Nodejs/dist/index.js {{directory}}/node-host.js

@_build_python_host directory:
echo "running python host"
cd Wox.Plugin.Host.Python &&
rm -rf python-host &&
rm -rf python-host.pyz &&
{{python_command}} -m pip install -r requirements.txt --target python-host &&
cp *.py python-host &&
{{python_command}} -m zipapp -p "interpreter" python-host &&
rm -rf python-host &&
cd ..
mkdir -p {{directory}}
cp Wox.Plugin.Host.Python/python-host.pyz {{directory}}/python-host.pyz

@_build_flutter:
echo "running flutter command"
# flutter
cd Wox.UI.Flutter/wox && flutter clean && flutter build {{current_flutter_target}} && cd ..
rm -rf Wox/resource/ui/flutter
mkdir -p Wox/resource/ui/flutter

if [ "{{current_flutter_target}}" = "windows" ]; then \
  cp -r Wox.UI.Flutter/wox/build/{{current_flutter_target}}/x64/runner/Release Wox/resource/ui/flutter/wox; \
elif [ "{{current_flutter_target}}" = "linux" ]; then \
  cp -r Wox.UI.Flutter/wox/build/{{current_flutter_target}}/x64/release/bundle Wox/resource/ui/flutter/wox; \
elif [ "{{current_flutter_target}}" = "macos" ]; then \
  cp -r Wox.UI.Flutter/wox/build/{{current_flutter_target}}/Build/Products/Release/wox.app Wox/resource/ui/flutter; \
  chmod +x Wox/resource/ui/flutter/wox.app/Contents/MacOS/wox; \
fi

@run:
if [ "{{current_flutter_target}}" = "windows" ]; then
./Release/wox-windows-amd64.exe;
elif [ "{{current_flutter_target}}" = "linux" ]; then
./Release/wox-linux-amd64;
elif [ "{{current_flutter_target}}" = "macos" ]; then
open ./Release/wox.app;
fi`

@qianlifeng
Copy link
Member

well it just stops afterwards. Like it stops running. And I've run this 6 ot 7 times and everytime it just cuts the run with no error.

Screenshot 2024-04-28 at 8 52 06 PM

The build is success in your screenshot. It stops without any error. Now you can run Wox in your fav IDEs.

@SashvDave
Copy link
Author

how do I activate it? Like does the application get installed on my system? And then if I want to make any changes, do I need to rebuild the whole application?

Because I try using the hotkeys I set, but it doesn't make anything pop up.

@SashvDave
Copy link
Author

Also, would I need to uninstall the Wox production dmg?

@SashvDave
Copy link
Author

Also, you said in your favorite IDE's. If I try to make development changes, it can't run on my system regardless of application?

@qianlifeng
Copy link
Member

how do I activate it? Like does the application get installed on my system? And then if I want to make any changes, do I need to rebuild the whole application?

Because I try using the hotkeys I set, but it doesn't make anything pop up.

It depends, if your change is the backend of Wox (golang part), you don't need to run just dev again. Instead, if your change is flutter or nodejs host part, you need to just dev.

If there is nothing pop up, you can refer to the log located in ~/.wox/log/log to see if there is any error to prevent it popup. (normally the hotkey is token by other app)

There is not need to uninstall the Wox production dmg. You can also navigate to Wox folder inside Wox project and run go run -ldflags "-s -w -X 'wox/util.ProdEnv=true'" . from the commandline.

@SashvDave
Copy link
Author

hm, works fine when i run it from inside the wox directory, but not when I do just dev from the root directory. Is this not where I set the hot key?
Screenshot 2024-04-29 at 1 36 03 AM

@qianlifeng
Copy link
Member

hm, works fine when i run it from inside the wox directory, but not when I do just dev from the root directory. Is this not where I set the hot key? Screenshot 2024-04-29 at 1 36 03 AM

yes, you can change the default hotkey here. Or you can change the hotkey in the setting dialog.

@SashvDave
Copy link
Author

If I were okay ignoring the backend portion, like just omitting it entirely and just wanted to make fronted changes, is there no faster way to see those changes than to have to re-run just dev every single time?

@SashvDave
Copy link
Author

Is there a way to just run the flutter application independently to make frontend changes and use normal flutter run?

@qianlifeng
Copy link
Member

Is there a way to just run the flutter application independently to make frontend changes and use normal flutter run?

Run the wox in dev mode go run ., then run flutter with hot reload

@SashvDave
Copy link
Author

SashvDave commented Apr 30, 2024

I run go run . and then nothing happens. Is there some prompt that's supposed to allow me to do flutter reload after this command executes or something? Like do I need a hot reload for the flutter to render? If so, how do I do that? Because when I type R into the terminal after run go run ., nothing happens.

Screenshot 2024-04-30 at 8 36 35 AM

shows in my activity bar that it is running but toggling manually or with the hotkey doesn't work.

Screenshot 2024-04-30 at 8 23 33 AM

@qianlifeng
Copy link
Member

I run go run . and then nothing happens. Is there some prompt that's supposed to allow me to do flutter reload after this command executes or something? Like do I need a hot reload for the flutter to render? If so, how do I do that? Because when I type R into the terminal after run go run ., nothing happens.

Screenshot 2024-04-30 at 8 36 35 AM shows in my activity bar that it is running but toggling manually or with the hotkey doesn't work. Screenshot 2024-04-30 at 8 23 33 AM

go run . only starts the backend of the Wox. You need to run flutter to render the UI, please try following comand cd Wox.UI.Flutter/wox and then flutter run

@SashvDave
Copy link
Author

That works, thanks. For whatever reason, however, when I do this approach, I get two different ones that appear, any ideas why that is?

Screenshot 2024-04-30 at 10 43 26 AM

@SashvDave
Copy link
Author

yeah this is becoming an issue, it just creates duplicates of my wox thing

@SashvDave
Copy link
Author

Hey @qianlifeng, any updates on this issue? It has now created 4 different instances of wox, coming from the go dev . command. How do I erase those?

@qianlifeng
Copy link
Member

Please check if you start multiple flutter instances. flutter run should only start only one flutter UI.

@SashvDave
Copy link
Author

i tried flutter clean and go clean but same issue still.

@qianlifeng
Copy link
Member

Sorry to hear that. I don't know that much about your dev env, maybe you forget stop prev flutter instance or some other actions you may mistake. Maybe you can try to kill all Wox processes and start overall again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants