ganeshh123 / notion-pdf-export

A tool to allow batch PDF export for free Notion users. You can export as HTML and then use this tool to convert those into PDFs.
https://app.gn3.sh/notion-pdf-export/
MIT License
427 stars 27 forks source link

"Not a directory" error when running 'notion-pdf-export' shell script on some macOS systems #22

Open mixelpixel opened 3 years ago

mixelpixel commented 3 years ago

Terminal.app flashes up for a hot milisecond, but after placing Notion's HTML export (including sub-pages) files in the app folder, the job never loads. This command is invoked:

/Users/this_user/Desktop/notion-pdf-export_mac_1/notion-pdf-export ; exit;

But no PDFs.

Using zsh.

ganeshh123 commented 3 years ago

Is this an M1 or Intel Mac? Could you try running the application from the terminal, and see what the error message was?

Alternatively, try running the npe file as an executable in the terminal:

chmod +x ./npe
./npe
mixelpixel commented 3 years ago

2.9 GHz Quad-Core Intel Core i7

This worked! Thank you so much!!

Alternatively, try running the npe file as an executable in the terminal:

chmod +x ./npe
./npe
mixelpixel commented 3 years ago

I feel like I should have known how to do that

ganeshh123 commented 3 years ago

Hmm, it should be working when just double clicking the file though. Could you try running

./notion-pdf-export

in the terminal, and show me what the error says?

mixelpixel commented 3 years ago

huh... says

% ./notion-pdf-export 
./notion-pdf-export: line 3: cd: ./notion-pdf-export/..: Not a directory

Please add some HTML files to this folder

Close this Window to Exit
-------------------------------

and that was invoked in the directory which has the executable file, notion-pdf-export

% ls -al
drwx------@   10        320 Apr 22 13:32 .
drwx------@   57       1824 Apr 22 14:41 ..
-rw-r--r--@    1      14340 Apr 22 14:46 .DS_Store
-rw-r--r--@    1       1065 Sep 29  2020 LICENSE
-rwxr-xr-x@    1         29 Sep 29  2020 notion-pdf-export
-rwxr-xr-x@    1   39522130 Sep 29  2020 npe
drwxr-xr-x  3663     117216 Apr 22 13:37 pdfs
drwxr-xr-x@    3         96 Sep 29  2020 utils
ganeshh123 commented 3 years ago

Thanks a lot, I'll look into it!

Scankiran commented 3 years ago

Guys, you have to give permission then you should system requirements -> Security. When you run program it won't be work because of Security. You should stop then select 'open anyway' on Security. You should do two times when run program. After all of, program can work perfectly. And It has already saved me hours. Thanks a lot!

ganeshh123 commented 3 years ago

Guys, you have to give permission then you should system requirements -> Security. When you run program it won't be work because of Security. You should stop then select 'open anyway' on Security. You should do two times when run program. After all of, program can work perfectly. And It has already saved me hours. Thanks a lot!

Thank you! That could be it, I forgot to include that in the instructions. Usually, it's supposed to say "cannot run because unidentified developer" but maybe the error doesn't show when running through a shell script, so you might have to do it twice, like you said. I'll try and add this to the docs at some point: image

thibdonz commented 2 years ago

Hi @ganeshh123,

Unfortunately, it doesn't work for me. Here is the error message.

Can you please help me ? Thanks in advance !!

`Last login: Tue Aug 9 16:39:30 on ttys000 /Users/thibaud/Desktop/notion-pdf-export_mac_1.3.0/notion-pdf-export ; exit; thibaud@MacBook-Pro-de-DONZIER-2 ~ % /Users/thibaud/Desktop/notion-pdf-export_mac_1.3.0/notion-pdf-export ; exit; /Users/thibaud/Desktop/notion-pdf-export_mac_1.3.0/notion-pdf-export: line 3: cd: /Users/thibaud/Desktop/notion-pdf-export_mac_1.3.0/notion-pdf-export/..: Not a directory /Users/thibaud/Desktop/notion-pdf-export_mac_1.3.0/notion-pdf-export: line 5: ./npe: No such file or directory

Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Opération terminée]

`

ganeshh123 commented 2 years ago

@thibdonz I am still not sure what causes it, in the mean time, could you try doing what is described in the second comment of this issue?

thibdonz commented 2 years ago

yes and get this message.

`Last login: Sun Aug 14 20:59:27 on ttys000 /Users/donzierthibaud/Desktop/notion-pdf-export_mac_1.3.0/npe ; exit;
donzierthibaud@MacBook-Pro-de-DONZIER-2 ~ % /Users/donzierthibaud/Desktop/notion-pdf-export_mac_1.3.0/npe ; exit; fs.js:115 throw err; ^

Error: EPERM: operation not permitted, scandir '/Users/donzierthibaud/.Trash' at Object.readdirSync (fs.js:783:3) at Object.readdirSync (/Users/donzierthibaud/Desktop/notion-pdf-export_mac_1.3.0/npe:191:50) at getAllFilePaths (/snapshot/src/get_all_filepaths.js:11:26) at files.forEach (/snapshot/src/get_all_filepaths.js:15:7) at Array.forEach () at getAllFilePaths (/snapshot/src/get_all_filepaths.js:13:9) at readHtmlFiles (/snapshot/src/read_html_files.js:8:20) at Object. (/snapshot/index.js:18:17) at Module._compile (internal/modules/cjs/loader.js:688:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)

Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Opération terminée]

`

ganeshh123 commented 2 years ago

Oh, sorry. Do you know how to use NodeJS?

thibdonz commented 2 years ago

Nope unfortunately :(

Thibaud Donzier

☎️ +33 6 78 38 10 75 📧 @.***

Le dim. 14 août 2022, 21:40, Ganesh H @.***> a écrit :

Oh, sorry. Do you know how to use NodeJS?

— Reply to this email directly, view it on GitHub https://github.com/ganeshh123/notion-pdf-export/issues/22#issuecomment-1214436995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV7AZMJLM4RSSQP75V3R32LVZFDRBANCNFSM43KXAK7A . You are receiving this because you were mentioned.Message ID: @.***>

ganeshh123 commented 2 years ago

Another alternative is if you have a Windows machine or Parallels, the Windows version doesn't have this issue, might be worth trying with that.

rubenvl2 commented 1 year ago

This can be solved following these steps:

  1. Follow the instructions to place the tool inside of the html folder
  2. open terminal and go to the folder
  3. run sh notion-pdf-export
  4. it will throw an error to move to trash for not allowed, cancel it
  5. go to security settings, a new alert indicating this will appear, allow anyway, will require password
  6. repeat 3
  7. a new error, but now for the pdf utily will appear, cancel it, repeat step 5 in security, the pdf tool will be there
  8. repeat 3

and with that, all PDFs will be generated. Only requires extra security concerns to be allowed.

:)