fabi1cazenave / node-html2epub

Convert a bunch of HTML documents into an EPUB
MIT License
36 stars 10 forks source link

'TypeError: mime.lookup is not a function' for Node 12 #5

Open mwoz123 opened 3 years ago

mwoz123 commented 3 years ago

can't run - "TypeError: mime.lookup is not a function"

 marcin@pc:~/workspace/sony/helpguide.sony.net/dmp/nwws410/v1$ node --version
v12.17.0
marcin@pc:~/workspace/sony/helpguide.sony.net/dmp/nwws410/v1$ npm --version
6.14.4
marcin@pc:~/workspace/sony/helpguide.sony.net/dmp/nwws410/v1$ ll pl/
total 8
drwxrwxr-x 1 marcin users   70 lis 30 09:30 ./
drwxrwxr-x 1 marcin users   48 lis 30 09:30 ../
drwxrwxr-x 1 marcin users   16 lis 29 14:39 common/
drwxrwxr-x 1 marcin users 3826 lis 29 14:42 contents/
drwxrwxr-x 1 marcin users 1232 lis 29 14:40 cover/
-rw-rw-r-- 1 marcin users 6369 sie 29  2018 index.html
drwxrwxr-x 1 marcin users   26 lis 29 14:39 search/

marcin@pc:~/workspace/sony/helpguide.sony.net/dmp/nwws410/v1$ npx html2epub --config=/home/marcin/Pobrane/epub3.json --basedir=pl
npx: installed 69 in 3.353s
  downloading: http://www.idpf.org/epub/301/spec/epub-publications.html
  downloading: http://www.idpf.org/epub/301/spec/epub-mediaoverlays.html
  downloading: http://www.idpf.org/epub/301/spec/epub-overview.html
  downloading: http://www.idpf.org/epub/301/spec/epub-contentdocs.html
  downloading: http://www.idpf.org/epub/301/spec/epub-ocf.html
/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:380
    var type = mime.lookup(href);
                    ^

TypeError: mime.lookup is not a function
    at /home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:380:21
    at Array.forEach (<anonymous>)
    at buildOPF_manifest (/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:378:9)
    at html2epub.showOPF (/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:433:5)
    at appendIndex (/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:611:25)
    at appendContent (/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:619:7)
    at /home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:670:7
    at IncomingMessage.<anonymous> (/home/marcin/.npm/_npx/29731/lib/node_modules/html2epub/lib/index.js:585:32)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1221:12)
marcin@pc:~/workspace/sony/helpguide.sony.net/dmp/nwws410/v1$ 
MallabaevAzamat commented 3 years ago

You can use mime.getType function as mime.lookup in this context. Mime updated to 2nd version.