xarantolus / Collect

A server to collect & archive websites that also supports video downloads

Home Page:https://010.one/Collect/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Content file not being created

SuperSandro2000 opened this issue · comments

I am not sure what you what to know so:

I get this:

Error 500
ENOENT: no such file or directory, open 'public/s/content.json'

Have this installed:

npm -v
5.8.0
nodejs -v
v8.11.4

and run this to start

sudo npm start production

Thanks for the report.

Usually the server should ignore if the file doesn't exist and assume that there are zero entries in the archive.
I tried installing the server from scratch using the same node version (but on Windows) and was able to start it without problems, so I'm not sure if this can help you:

  • Add a site to the archive by going to http://yourserver:port/new directly and entering any site you want. The content file is first created when the server finished downloading the first entry. After this, the error might go away.

  • You could create the file at /path/to/Collect/Collect/public/s/content.json manually. The default content for this file is []. After a restart (or even just a website reload) the website should display that there are no sites in the archive.

  • If it is related to some kind of permission error (maybe when creating the file; but this should log an error to the console) you might get a different result when changing permissions of the s directory; but I believe that this is not the case as you used sudo

  • The last option I can think of would be using a different node version. I use node v10.14.2 and npm 6.4.1 on a Raspberry Pi and haven't encountered this problem yet

  • Add a site to the archive by going to http://yourserver:port/new directly and entering any site you want. The content file is first created when the server finished downloading the first entry. After this, the error might go away.

Then I get this error.

Processing url https://github.com/xarantolus/Collect
Error while processing url https://github.com/xarantolus/Collect:
Error: ENOENT: no such file or directory, open 'public/s/content.json'
{ Error: ENOENT: no such file or directory, open 'public/s/content.json'
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'public/s/content.json' }
  • You could create the file at /path/to/Collect/Collect/public/s/content.json manually. The default content for this file is []. After a restart (or even just a website reload) the website should display that there are no sites in the archive.

This worked. Hope this is enough for you to fix it. If you need to test something hit me up and I can test it for you.

  • If it is related to some kind of permission error (maybe when creating the file; but this should log an error to the console) you might get a different result when changing permissions of the s directory; but I believe that this is not the case as you used sudo

yeah, should not be the problem.

  • The last option I can think of would be using a different node version. I use node v10.14.2 and npm 6.4.1 on a Raspberry Pi and haven't encountered this problem yet

I updated node and the same happened.

I think the problem was that it only checked a specific error number that seems to only work on Windows. From now on, the server automatically generates the file so that it always exists, but it also checks the more generic error code ENOENT if it doesn't.

If you want to test it on your system, you can download the new version and see if it still throws the error if the file doesn't exist. (But watch out, if you delete the content.json file all directories with websites will be deleted automatically, so it might be better to install it somewhere else and delete it after that)

works now.
I don't know if you have tests but maybe you should think about doing some or test it from time to time on linux on a server or vm just to make sure that the program works.