wakatime / vim-wakatime

Vim plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vim
BSD 3-Clause "New" or "Revised" License
1.04k stars 70 forks source link

Error installing wakatime-cli on Windows, incompatible npm wakatime-cli accidentaly used #171

Closed KevFlo closed 11 months ago

KevFlo commented 11 months ago

I am having issues installing vim on a corp win10 laptop. Its behind a proxy which has been set up in wakatime.cfg Ive installed it via the extension manager in vscode and it constantly shows Wakatime Initializing When I turn on debug mode, there is no wakatime output in the developer tools console. There is also no wakatime.log in ~/.wakatime/

This issue #170 is similar. This is the error in vim when I did :Wakatimedebugenable Error detected while processing BufEnter Autocommands for "*"..function <SNR>10_InitAndHandleActivity[4]..<SNR>10_HandleActivity[10]..<SNR>10_AppendHeartbeat[21]..<SNR>10_SendHeartbeats: line 121: [WakaTime] Command: "wakatime" "--entity" "C:\Users\kf\.wakatime.cfg" "--time" "1700018840" "--plugin" "vim/900 vim-wakatime/10.0.0" "--alternate-language" "cfg"^@[WakaTime] Error: No arguments given^@No arguments given^@No arguments given^@No arguments given^@No arguments given^@No arguments given^@No arguments given^@No arguments given^@ Press ENTER or type command to continue

alanhamlett commented 11 months ago

Does the binary ~/.wakatime/wakatime-cli.exe exist in your home folder?

I notice it's running just wakatime not wakatime-cli in your error output. That means it found a binary in your $PATH named wakatime:

https://github.com/wakatime/vim-wakatime/blob/3c6c5bf17f4ae6c53396667ce3405df02a80b894/plugin/wakatime.vim#L118

Try removing that wakatime binary from your $PATH because it could be preventing vim-wakatime from trying to install the current wakatime-cli version when it thinks it's already installed.

KevFlo commented 11 months ago

Does the binary ~/.wakatime/wakatime-cli.exe exist in your home folder?

I notice it's running just wakatime not wakatime-cli in your error output. That means it found a binary in your $PATH named wakatime:

https://github.com/wakatime/vim-wakatime/blob/3c6c5bf17f4ae6c53396667ce3405df02a80b894/plugin/wakatime.vim#L118

Try removing that wakatime binary from your $PATH because it could be preventing vim-wakatime from trying to install the current wakatime-cli version when it thinks it's already installed.

yes, wakatime-cli.exe exists in my home folder. It's a symlink to ~.wakatime\wakatime-cli-windows-amd64.exe

Let me try what you suggested, will update when done.

KevFlo commented 11 months ago

Funny enough, there is no 'wakatime' in the $PATH it only contains ..\python311 ..\python311\scripts c\bin c\bin\gvim c\users\kf\appdata\roaming\npm

alanhamlett commented 11 months ago

Funny enough, there is no 'wakatime' in the $PATH it only contains ..\python311 ..\python311\scripts c\bin c\bin\gvim c\users\kf\appdata\roaming\npm

Yes, but there might be a wakatime binary inside one of those folders? What happens when you type where wakatime in a cmd prompt?

KevFlo commented 11 months ago

You are right I found it under /npm/ . I removed it and started vim... was prompted for my api key. then I got this output. Microsoft store is blocked under my corp. but I do have python311 installed. IS there a specific version that wakatime needs?

[WakaTime] error installing wakatime-cli for Windows: Python was not found but can be installed from the Microsoft Store: ms-windows-store://pdp/?productid=9NJ46SX7X90P\nWill retry using Vim built-in Python.

alanhamlett commented 11 months ago

You are right I found it under /npm/ . I removed it and started vim...

That must be a third party cli like https://www.npmjs.com/package/wakatimecli conflicting with wakatime-cli.

I do have python311 installed. IS there a specific version that wakatime needs?

Try adding this line pointing to your python311 exe in your ~/.vimrc file: let g:wakatime_PythonBinary = '/path/to/python.exe'

alanhamlett commented 11 months ago

Related, no longer using wakatime-cli from npm after 773eb4daf3d4325242a3f0ff232ba895ecd081b0.