You can run a JavaScript scratch file using the corresponding action in its right-click menu:
Typescript scratch files can't be run for the same reason as non-scratch .ts files: Typescript can't be executed directly, it has to be transpiled to JavaScript first
You can run a JavaScript scratch file using the corresponding action in its right-click menu:
Typescript scratch files can't be run for the same reason as non-scratch .ts files: Typescript can't be executed directly, it has to be transpiled to JavaScript first
Thanks, can i use something like ts-node to run my .ts scratch files?
You can try using
--require ts-node/register
in your run configuration, like:of course, you have to install
ts-node
in your project firstThanks, it works! I also can have `ts-node` installed globally? To remove a need to install it in every project.
requiring global modules doesn't usually work, unless you use special tricks like
NODE_PATH;
note that requiring global modules is not recommended:
Just trying to run the file created an SQL run configuration for me. It told me "Error: No configured target data sources", which doesn't make sense.
Instead, I created a local package.json that contained this line, and then I clicked the play button next to that.
Same here as Fireslinger
I created a JavaScript scratch file, right-click then run and a dialog saying "No configured target data sources"
Why?
What IDE version do you use? It looks similar to https://youtrack.jetbrains.com/issue/DBE-14638/JS-files-run-as-Database-Script-but-not-NodeJS that is fixed in 2022.1
2021.3.1
Build #IU-213.6461.79, built on December 28, 2021
I see, thanks for update. Please consider upgrading, the bug is fixed in 2022.1