Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running via npx : "SyntaxError: Unexpected token ." #441

Closed
noofny opened this issue Jan 25, 2023 · 7 comments
Closed

Error running via npx : "SyntaxError: Unexpected token ." #441

noofny opened this issue Jan 25, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@noofny
Copy link

noofny commented Jan 25, 2023

This error appears when attempting to execute directly using npx as per the README...

$ npx -p yarle-evernote-to-md@latest yarle --configFile ./me.config.json
logfilepath: /Users/me/Library/Application Support/yarle-evernote-to-md/conversion.log
/Users/me/.npm/_npx/36577/lib/node_modules/yarle-evernote-to-md/node_modules/jsdom/lib/jsdom/browser/parser/html.js:170
    after._pushedOnStackOfOpenElements?.();
                                       ^

SyntaxError: Unexpected token .
    at Module._compile (internal/modules/cjs/loader.js:718:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/me/.npm/_npx/36577/lib/node_modules/yarle-evernote-to-md/node_modules/jsdom/lib/jsdom/browser/parser/index.js:4:20)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)

Also tried using the default config file bundled with latest code.

Running on macOS 12.6.2 (21G320)

$ node --version
v12.3.1
$ npx --version
6.9.0

Upgraded node/npm/npx, now raises the following error...

$ npx -p yarle-evernote-to-md@latest yarle --configFile ./me.logseq.config.json
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2023-01-25T04_34_30_599Z-debug.log
Install for [ 'yarle-evernote-to-md@latest' ] failed with code 1
$ node --version
v19.4.0
$ npx --version
10.2.2

Log file from above /Users/me/.npm/_logs/2023-01-25T04_34_30_599Z-debug.log is as follows...

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/19.4.0_1/bin/node',
1 verbose cli   '/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'yarle-evernote-to-md@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   '/Users/me/.npm/_npx/40923',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v19.4.0
4 verbose npm-session 7e4c67148b209af6
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/yarle-evernote-to-md 1024ms (from cache)
8 silly pacote tag manifest for yarle-evernote-to-md@latest fetched in 1047ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack     at /usr/local/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (node:fs:191:5)
10 verbose cwd /Users/me/Development/akosbalasko/yarle
11 verbose Darwin 21.6.0
12 verbose argv "/usr/local/Cellar/node/19.4.0_1/bin/node" "/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "yarle-evernote-to-md@latest" "--global" "--prefix" "/Users/me/.npm/_npx/40923" "--loglevel" "error" "--json"
13 verbose node v19.4.0
14 verbose npm  v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]
@github-actions
Copy link

Yihaa, thank you for reporting me this issue and to let me improve Yarle!

@akosbalasko
Copy link
Owner

hi @noofny ,

pls try to use Yarle via UI until i fix this issue. Thanks for reporting it, i'll do my best to sort it out soon!

@akosbalasko akosbalasko added the bug Something isn't working label Jan 25, 2023
@noofny
Copy link
Author

noofny commented Jan 25, 2023

Super quick response, wow thank you @akosbalasko - also thank you for your efforts on the tool. Once I see it will work for my use I'll help by donating.

One question: when I use the GUI (as I have been doing) - is there a way to specify your own config.json file, or your own template please? The GUI disables editing the template window when you select "LogSeq" as the target dialect and the tags on that dialect are missing the "#" prefix in front of each one, which is what I wish to have.

Anyways, thanks again for your efforts, your tool is the only decent tool around that does this conversion and provides great options.

@akosbalasko
Copy link
Owner

akosbalasko commented Jan 25, 2023

Hi @noofny
Those fields are disabled in the case of LogSeq, because IMHO the default settings guarantee that Logseq can recognize the produced set of MD files. But this is just kinda minimal support for Logseq, so if you think that it would be meaningful to enable some or all fields in the UI to make them configurable I can improve the UI to resolve these limitations. Templates should work by default it is disabled in the UI only, # in tags is an open question, I don't remember by heart.

About npx: could you please clear cache and try again on node 19 (it should work also,however it is tested on 14 16 and 18):

npm clean cache —force
(based on this issue: nodejs/help#2874)
sorry, this is the correct command:
npm cache clean –force

@akosbalasko
Copy link
Owner

@noofny any news?

@noofny
Copy link
Author

noofny commented Jan 30, 2023

My apologies @akosbalasko I was away over the weekend.

Just tried now by clearing cache and re-running, sadly the same error appears...

npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2023-01-30T00_43_01_988Z-debug.log
Install for [ 'yarle-evernote-to-md@latest' ] failed with code 1

Contents of that log file are...

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/19.4.0_1/bin/node',
1 verbose cli   '/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'yarle-evernote-to-md@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   '/Users/me/.npm/_npx/6811',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v19.4.0
4 verbose npm-session 1fab292589aa4b26
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/yarle-evernote-to-md 1820ms
8 http fetch GET 200 https://registry.npmjs.org/yarle-evernote-to-md/-/yarle-evernote-to-md-5.0.2.tgz 2618ms
9 silly pacote tag manifest for yarle-evernote-to-md@latest fetched in 4478ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack     at /usr/local/lib/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
10 verbose stack     at FSReqCallback.oncomplete (node:fs:191:5)
11 verbose cwd /Users/me/Development/akosbalasko/yarle
12 verbose Darwin 21.6.0
13 verbose argv "/usr/local/Cellar/node/19.4.0_1/bin/node" "/usr/local/lib/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "yarle-evernote-to-md@latest" "--global" "--prefix" "/Users/me/.npm/_npx/6811" "--loglevel" "error" "--json"
14 verbose node v19.4.0
15 verbose npm  v5.1.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]

Thanks for following up.

When you select "LogSeq" as the target dialect, the GUI disables editing of the template text box (does not happen when selecting other dialect options), if this could not happen, so that you can still edit the template, it would solve half of my problem as I could at least change the behavior of the tags/output.

Perhaps another idea is to have a button that the user can load/open a config.json file instead of using the selections in the GUI?

@noofny
Copy link
Author

noofny commented Jan 30, 2023

Got it working.

It was nothing wrong with your code, just a local machine/environment issue. FWIW below are the 2 links that ended up guiding me out of the forest, but I ended up doing a full uninstall of Node and a manual cleanup, then a clean install using brew.

What I ended up with as a working environment was...

$ node --version
v19.5.0

$ npm --version
9.3.1

$ npx --version
9.3.1

Thanks again for your support.

@noofny noofny closed this as completed Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants