dmuth / evernote-to-obsidian

Wrapper for the Yarle app to make converting Evernote notebooks to Markdown easier
Apache License 2.0
168 stars 15 forks source link

Script fails due to mv: rename notes/* to *: No such file or directory? #5

Open 2600box opened 2 years ago

2600box commented 2 years ago

Any idea how to make the script work?

➜  evernote-to-obsidian git:(main) ✗ bash -x ./convert-evernote-to-markdown.sh evernote-notebooks
+ set -e
+ test '!' evernote-notebooks
+ NOTEBOOK=evernote-notebooks
+ TARGET=markdown-exports
++ which yarle
+ test '!' /usr/local/bin/yarle
+ echo '# Yarle already installed...'
# Yarle already installed...
+ cat config.json.in
++ pwd
+ sed -e 's|%DIR%|/Users/2600/dev/evernote-to-obsidian|g' -e 's|%NOTEBOOK%|evernote-notebooks|g' -e 's|%TARGET%|markdown-exports|g'
+ yarle --configFile ./config.json
logfilepath: /Users/2600/Library/Application Support/yarle-evernote-to-md/conversion.log
clearing log: /Users/2600/Library/Application Support/yarle-evernote-to-md/conversion.log
Loading config from /Users/2600/dev/evernote-to-obsidian/./config.json
clearing log: /Users/2600/Library/Application Support/yarle-evernote-to-md/conversion.log
+ pwd
/Users/2600/dev/evernote-to-obsidian
+ echo

+ echo

+ echo '# Moving directories from markdown-exports/notes/ into just markdown-exports...'
# Moving directories from markdown-exports/notes/ into just markdown-exports...
+ pwd
/Users/2600/dev/evernote-to-obsidian
+ pushd markdown-exports
+ for FILE in 'notes/*'
++ basename 'notes/*'
+ DEST='*'
+ test -e '*'
+ echo '# Moving notes/notes/* to *...'
# Moving notes/notes/* to *...
+ mv 'notes/*' '*'
mv: rename notes/* to *: No such file or directory
dmuth commented 2 years ago

Looking at those last couple of lines, it looks like your notes/ directory is empty. Why? I have no idea, but you could poke around in your directory structure and see if they're in another directory.

2600box commented 2 years ago

yes, it is empty but I don't understand what should be there?

the enex files are in evernote-notebooks directory per your recommendation.

the below comment makes it seem even stranger

thanks!

#
# This crazy logic here is to do the following:
# 
# 1) Move the various notebooks out of the notes/ directory and into the parent, because
# I see not point to the notes/ directory existing.
# 
# 2) In an effort to make things more user-friendly, if this script has been run before,
# simply add an ascending number to the end and try again, instead of having the script bail.
#
#

I also don't see notes anywhere in the screenshots at https://www.dmuth.org/migrating-from-evernote-to-obisidian/

Sorry if I am being dense here!

dmuth commented 2 years ago

No worries, it's all good! As for what is happening, I'm out of ideas.

So how would I solve this? Us engineers usually solve problems like these by reproducing them on our end and tweaking code as necessary. If we were co-workers in an office environment, you'd pass me your ENEX files and I'd work on it. But since we're not co-workers, you probably don't want to give me your ENEX files and I don't want them either. :-)

If you want to continue using this script, you could ask around in your social network and see if anyone you know/trust who is local to you wouldn't mind poking around on your setup to try and solve the problem. (And they're welcome to reach out to me well) If that's not an option, the path of least resistance would unfortunately be to try another method. Sorry I can't be of more help there.

-- Doug

nickboucart commented 2 years ago

Ran into the same problem.

Turns out that simply copying the convert-evernote-to-markdown.sh file isn't enough (the blog post suggested this). One also needs to copy the config.json.in file and the template.tmpl file. Better even, just clone the entire project and it works. Hope this helps.

AlphaGit commented 2 years ago

Hi! I came across this same error (I think) and I was able to sort the problem.

Here's the full error output:

Full command and output ``` ❯ ./convert-evernote-to-markdown.sh evernote-notebooks/ # Yarle already installed... logfilepath: /Users/alpha/Library/Application Support/yarle-evernote-to-md/conversion.log clearing log: /Users/alpha/Library/Application Support/yarle-evernote-to-md/conversion.log (node:7863) UnhandledPromiseRejectionWarning: Error: Cannot find module 'minimist' Require stack: - /Users/alpha/.nvm/versions/node/v14.17.3/lib/node_modules/yarle-evernote-to-md/dist/dropTheRopeRunner.js - /Users/alpha/.nvm/versions/node/v14.17.3/lib/node_modules/yarle-evernote-to-md/dist/dropTheRope.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at Object.run (/Users/alpha/.nvm/versions/node/v14.17.3/lib/node_modules/yarle-evernote-to-md/dist/dropTheRopeRunner.js:34:18) at Object. (/Users/alpha/.nvm/versions/node/v14.17.3/lib/node_modules/yarle-evernote-to-md/dist/dropTheRope.js:26:19) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) (Use `node --trace-warnings ...` to show where the warning was created) (node:7863) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:7863) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. # Moving directories from markdown-exports/notes/ into just markdown-exports... ./convert-evernote-to-markdown.sh: line 52: pushd: markdown-exports: No such file or directory ```

Now, the final lines make you think that the error was the directory not being found. If you manually create it, then the same error about /notes/* not being found pops up.

However, this is just a consequence of the script continuing the execution when the initial conversion failed.

The initial error is this one:

(node:7863) UnhandledPromiseRejectionWarning: Error: Cannot find module 'minimist'

Turns out that installing yarle through npm does not bring over it's dependency minimist. (Why, I have not investigated.) Since yarle in the script is installed through npm global, executing this solved the problem for me:

npm install -g minimist

I hope this helps!