kangruixiang / Ankify

Ankify notes into anki cards
https://ankify.krxiang.com/
46 stars 2 forks source link

Ankify script on macOS #7

Closed DutchPete closed 8 months ago

DutchPete commented 4 years ago

It is not working. This is what I have as my .env file:

# .env

ROOT_DIR="/Volumes/NO NAME/Test"
ATTACHMENT_FOLDER="/Volumes/NO NAME/Scripts/Ankify-master/images"
ANKI_PROFILE="/Users/peter/Library/Application Support/Anki2/User 1/collection.media"

BUCKET_ID=""
API_KEY_ID=""
API_KEY=""
BUCKET_NAME=""
B2_BASE=""

And this is the output from the terminal after doing Ankify:

Peters-MacBook-Air:~ peter$ ankify

TypeError: Cannot read property 'authorize' of undefined
    at getFiles (/Volumes/NO NAME/Scripts/Ankify-master/lib/b2.js:37:22)
    at Object.<anonymous> (/Volumes/NO NAME/Scripts/Ankify-master/lib/b2.js:106:1)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Function.Module._load (internal/modules/cjs/loader.js:781:14)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Volumes/NO NAME/Scripts/Ankify-master/index.js:11:24)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
Error: ENOENT: no such file or directory, unlink '/Volumes/NO NAME/Test/_html/Test.html'
    at Object.unlinkSync (fs.js:1162:3)
    at Object.<anonymous> (/Volumes/NO NAME/Scripts/Ankify-master/index.js:77:6)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Function.Module._load (internal/modules/cjs/loader.js:781:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -2,
  syscall: 'unlink',
  code: 'ENOENT',
  path: '/Volumes/NO NAME/Test/_html/Test.html'
}
internal/fs/utils.js:298
    throw err;
    ^

Error: ENOENT: no such file or directory, copyfile '/Volumes/NO NAME/Scripts/Ankify-master/images/1.png' -> '/Users/peter/Library/Application Support/Users/peter/Library/Application Support/Anki2/User 1/collection.media/1.png'
    at Object.copyFileSync (fs.js:1941:3)
    at Object.<anonymous> (/Volumes/NO NAME/Scripts/Ankify-master/index.js:89:8)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Function.Module._load (internal/modules/cjs/loader.js:781:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -2,
  syscall: 'copyfile',
  code: 'ENOENT',
  path: '/Volumes/NO NAME/Scripts/Ankify-master/images/1.png',
  dest: '/Users/peter/Library/Application Support/Users/peter/Library/Application Support/Anki2/User 1/collection.media/1.png'
}
Peters-MacBook-Air:~ peter$ 
kangruixiang commented 4 years ago

For the anki profile you don't need the part before anki2. It should just be anki2/User 1/collection.media