ghostboard / ghost-purge-images

CLI tool to display & purge the uploaded images, video and audio files that currently are not used in any post, page or meta data
MIT License
95 stars 4 forks source link

Not quite working, unfortunately - #6

Closed Maxszik closed 4 years ago

Maxszik commented 4 years ago

Hi there, great work on your part, very appreciated for sure.

Upgrading to the latest 3.0 variant, things doesn't quite work. When I try to run it says

ghost-mgr@ghost-caucasusandmercury:~$ ghost-purge-images display --content-key=69891a65807dc1931c98406ded --admin-key=5cefed645c7944048554b2d5:b50084fd0cdda8fa7cb93fb2f17c2537cd294aa1f540b3f307ca6dbedc48da8b
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'jsonwebtoken'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/lib/node_modules/ghost-purge-images/lib/ghost/auth.js:1:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
ghost-mgr@ghost-caucasusandmercury:~$ 

before that, when upgrading, I got a message saying:

root@ghost-caucasusandmercury:~# npm install -g ghost-purge-images
/usr/bin/ghost-purge-images -> /usr/lib/node_modules/ghost-purge-images/bin/ghost-purge-images.js
npm WARN notsup Unsupported engine for ghost-purge-images@3.0.0: wanted: {"node":"8.12.0","npm":"6.0.0"} (current: {"node":"10.18.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: ghost-purge-images@3.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/ghost-purge-images/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ ghost-purge-images@3.0.0
added 109 packages from 567 contributors, removed 14 packages and updated 11 packages in 8.765s

And yes, I tried doing the sudo chmod -R a+rw content thing.

...so something about node I guess? Kind regards !

dburgos commented 4 years ago

Hi @Caucasus-and-Mercury ,

The issue was not related to Node version but I updated the engines block to avoid the warning šŸ‘

Please install latest version v3.0.2 released some minutes ago and try again

Sorry for the inconvenience, thanks for reporting & your patience :)

Maxszik commented 4 years ago

Sorry still not working in my case. I've messed around with file permissions before, so it might be only for me? Anyway, when I try to run I'm getting this:

root@ghost-caucasusandmercury:/var/www/ghost# ghost-purge-images display --content-key=69891a65807dc1931c98406ded --admin-key=5cefed645c7944048554b2d5:b50084fd0cdda8fa7cb93fb2f17c2537cd294aa1f540b3f307ca6dbedc48da8b
internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module 'minimist'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/lib/node_modules/ghost-purge-images/lib/ghost/content.js:7:14)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
root@ghost-caucasusandmercury:/var/www/ghost# root@ghost-caucasusandmercury:/var/wwwroot@ghost-caucasusandmercury:/var/www/ghoroot@ghost-caucasusandroot@ghorootrootroot@ghost-caucaroot@ghororororoot@ghost-caucasusandmercury:/var/www/ghost# 
www/ghosty:/var/www/root@ghost-c

Thanks a lot, as always -

dburgos commented 4 years ago

hey @Caucasus-and-Mercury

Just released v3.0.3, please update to this version and try again

Sorry for the inconvenience & thanks for your patience šŸ‘

Maxszik commented 4 years ago

Almost there!

Now it's working, but not working quite as it should. Pictures are purged, but many pics are purged that are in use and should have been left untouched.

I struggle to find a pattern. Pics in use in post are purged, some but not all, seemingly randomly. Also pics used in drafts are purged, randomly it seems.

Any ideas? When running the end looks like this, if it helps:

(...)

- /var/www/ghost/content/images/2019/11/als-mosmetro-map-v4.0-jpg.jpg (0.83 MB)
- /var/www/ghost/content/images/2019/11/als-mosmetro-map-v4.0-jpg.png (1.41 MB)
šŸ“Š Summary:
- 2768 files of 2768 uploaded images (100.00%)
- Total space: 969.44MB
ā” Want to delete this files? Run `ghost-purge-images purge key=YOUR_KEY`
šŸŽ Open source tool by David Burgos from https://ghostboard.io
ghost-mgr@ghost-caucasusandmercury:/var/www/ghost$
dburgos commented 4 years ago

@Caucasus-and-Mercury all the images... pretty weird, let me know which Ghost version are you running. On the other hand, are you running ghost-purge-images version 3.0.3 (latest) ?

Maxszik commented 4 years ago

@dburgos not all images...although it says so. It purges many pics randomly, but not all.

I'm on the very latest ghost, and yes I suppose I'm running the latest ghost-purge-images version, having updated it according to instructions. Any way to really check which version I'm running?

dburgos commented 4 years ago

@Caucasus-and-Mercury In order to check Ghost version have a few ways to check it:

In order to check the ghost-purge-images version:

Maxszik commented 4 years ago

@dburgos well: running the latest 3.03 ghost purge, and the latest 3.6 Ghost. Still getting this issue.

- /var/www/ghost/content/images/2019/04/siberiannationalcostumes_yakutiarussia_01.jpg (0.09 MB)
- /var/www/ghost/content/images/2019/04/vladimir-kolodenko---aeroport.JPG (0.04 MB)

šŸ“Š Summary:
- 2771 files of 2771 uploaded images (100.00%)
- Total space: 969.57MB

ā” Want to delete this files? Run `ghost-purge-images purge key=YOUR_KEY`
šŸŽ Open source tool by David Burgos from https://ghostboard.io
ghost-mgr@ghost-caucasusandmercury:/var/www/ghost$ 
dburgos commented 4 years ago

@Caucasus-and-Mercury thanks for your help, I'm going to open another issue and investigate it, right now I can not reproduce it :(