rejetto / hfs

HFS is a web file server to run on your computer. Share folders or even a single file thanks to the virtual file system.
GNU General Public License v3.0
2.29k stars 227 forks source link

Unable to install/update hfs via npm [Win10] #501

Closed kam1kaze911 closed 8 months ago

kam1kaze911 commented 8 months ago

I am having a problem since hfs v50.1 that it will not update via npm. console returns this error (npm log):

745 verbose Windows_NT 10.0.19045
746 verbose node v21.6.1
747 verbose npm  v10.2.4
748 error code ENOENT
749 error syscall spawn git
750 error path git
751 error errno -4058
752 error enoent An unknown git error occurred
753 error enoent This is related to npm not being able to find a file.
753 error enoent
754 verbose exit -4058

now i tried to clean up everything including npm, node.js and every other npm package but no success. installing other packages (e.g., node-red) works fine. Also tried npx instead of npm but returns the same error.

how can i solve this issue? am I missing an environmental part?

rejetto commented 8 months ago

i cannot reproduce your problem. i tried both installing and upgrading with npm on my windows11, and found no problem. the error you see is from npm, not hfs.

i also tried the instructions in the readme to make it as a service, and it worked. i noticed Windows instructions use npm instead of npx, i'd like to change that, for easier upgrading.

if you cannot solve with npm, consider running hfs-windows.zip

kam1kaze911 commented 8 months ago

Sadly I couldn't manage to get it working again via npm. Perhaps someone comes across this type of error, maybe I will post this to npm discussions. Seems like sth npm and git problem to me.

Got HFS now running using hfs-windows.zip installed as a service with "NSSM - the Non-Sucking Service Manager".

Only thing I am wondering, will the .exe always will be named "new-hfs.exe (after update, originally hfs.exe)? This would be crucial to ensure a working service.

rejetto commented 8 months ago

during the update process, the file is named "new", but then renamed to "hfs.exe". It is possible that autoamtic update process is not compatible with services, i'm not sure about it. I'm willing to accept suggestions on these matters.

for your npm/git problem, i'd like to see more console output of the installation process, and what command are you using.

rockrider69 commented 8 months ago

Not to hijack, just to comment and share... I have been using "NSSM - the Non-Sucking Service Manager" to run HFS as a service, and when upgrading HFS version the process in HFS does not complete : not being able to force rename new-hfs.exe to hfs.exe because NSSM has the hfs.exe opened/blocked (I can see the message in debug.log). Never found a workaround to it (tried messing with hfs-updater plugin but with no success). Right now I have to manually stop the service - rename to hfs.exe - start the service. Not so critical in my case hopefully.

If @rejetto or anyone reading has a good suggestion how to fully automate upgrades with HFS as a service on Windows, I'd really appreciate ;-)

rejetto commented 8 months ago

i'm not expert with services. Making the update work with the executables across windows+mac+linux (without involving services) was a nightmare that took me a week of exhausting trial-and-error.

Maybe it is possible to add service management, like hfs stopping its own service and starting it again after the update, but this may require more days of work (on Windows, that's not even my system). It would be nice to get some help on this. For the moment I'm not tackling this.

One thing that I'm adding right now is to NOT allow automatic update if you are running as service.

YOu can see that on Linux I suggested to run as a service "npx -y hfs@latest", so that to update you just need to restart the service (or I hope so, i didn't try myself).

rockrider69 commented 8 months ago

"Maybe it is possible to add service management, like hfs stopping its own service and starting it again after the update, but this may require more days of work (on Windows, that's not even my system). It would be nice to get some help on this. For the moment I'm not tackling this."

Fully agreed, this is not critical at all !

When I have time I might try more tests based on "hfs-updater" HFS plugin but so far I blocked on how to stop/restart the service, without killing the plugin itself before it can even rename the exe... ;). A solution could be a separate "updater service" polling the new-hfs.exe presence and with the appropriate rights managing the stop/rename/start sequence...

kam1kaze911 commented 8 months ago

Solved the npm problem! I needed to install git so npm is able to find git. winget install --id Git.Git -e --source winget

Thought about the two ways running HFS hidden: Good thing about running HFS in npm environment is, that it's a service and managed by npm. Downside is, you need to create a task for updating with the commands from the readme.md.

Good thing about running HFS from zip is, you can update via Admin-panel which is convenient and the intended way to update. Downside is, it does not run hidden (service).

Currently I am experimenting with zip version and service configuration. The problem @rockrider69 describes needs to be solved - we will work sth out eventually :)

If this does not work, then the commands net stop <nameofservice> and net start <nameofservice> could solve the issue the updater could not rename the binary to 'hfs.exe'. Service name 'HFS' of course.

Thanks for the support and the discussion!

rejetto commented 8 months ago

Good thing about running HFS in npm environment is, that it's a service and managed by npm. Downside is, you need to create a task for updating with the commands from the readme.md.

what task? if you run it with npx -y hfs@latest as in my previous message, it should update just by restarting the service

made1990 commented 8 months ago

I am having the same issue as the issue creator, but only when try to install with the --proxy parameter.

rejetto commented 7 months ago

https://github.com/rejetto/hfs/issues/501#issuecomment-1969538625

rejetto commented 7 months ago

i've managed to solve this problem, so now you can npx -y hfs@latest