Closed pjobson closed 10 months ago
I also run in to this problem (running on Mac), (node.js 18 LTS).
So according to nodes url, the const myUrl = new URL(filename)
isn't valid (https://nodejs.org/api/url.html#urlpathtofileurlpath).
Instead it's recommended to use url.pathToFileURL
to get a file:///path/to/db
. However, deeper down in the stack (in the steno package) (and also in the TextFileSync), path.join(...)
is used, and at least on the Mac a path.join("file:///path/to/db")
returns file:/path/to/db
which also fails.
I'm using this in node environment.
Looks like JSONPreset
calls new URL
on the filename, which apparently means it requires a file:
scheme.
Then when it's stringified and passed to fsPromises.writeFile('file:/path/to/blah')
in steno/lib/index.js
,
node errors with
Uncaught [Error: ENOENT: no such file or directory, open 'file:/path/to/blah']
Thanks for the report, working on a fix
I published a fix. Can you give it another try?
It seems to work! Thanks.
Awesome :)
Not sure if you're still updating this or not.
Using the default example it throws
ERR_INVALID_URL
node 18.18.2.Changing the default to point to a url based path remedies the issue:
Edit... I take that back, it doesn't actually fix it, it doesn't do anything. No error, no file creation.