error: No config file found in VS Code
I'm new in Deno and in coding, and need help with the following issue. I have installed Deno through VS Code terminal and when I'm trying to run
deno start task
getting error: No config file found
, also when trying to run deno run --allow-net --allow-read ./src/index.ts
getting error: Module not found "file:///C:/Users/User/Documents/VS%20Code%20Projects/src/index.ts"
message. RN I'm in the process of learning Google Analytics 4 and I'm trying to run local web server according to https://github.com/googleanalytics/ga4-tutorials/blob/main/README.mdGitHub
ga4-tutorials/README.md at main · googleanalytics/ga4-tutorials
Contribute to googleanalytics/ga4-tutorials development by creating an account on GitHub.
13 Replies
When running
deno task start
deno looks file a deno.json
or deno.jsonc
file in the current directory. Inside this config file you can define some common tasks for your project, which is typically done to save some typing. In this case you're trying to run a task named start
with your command. An example of how such a config file might like:
But in your case it looks like such a file doesn't even exist. So deno throws a "no config file found" error. Common mistakes are that you're executing the command in the wrong folder.
Regarding to the other "Module not found" error: That error is thrown when the requested file doesn't exist on your file system. There simply isn't a file at C:/Users/User/Documents/VS Code Projects/src/index.ts
. Could be that you typed the path wrong or you are in the wrong directory. If you cloned the linked ga4-tutorials repository you need to move into the project folder in your shell to be able to run the commands. It looks like that's the cause for both of the errors you're seeingThanks for the detailed explanation, it was very helpful. But, now I'm getting
Error: Syntax error in file name, folder name, or volume label. (os error 123): lstat 'C:\C:\Users\User\Documents\VS%20Code%20Projects\ga4-tutorials-main\src\public\index.et
huh why are there duplicate path segments?
C:\C:\
looks super wrongDo you have a repo we can take a look at?
GitHub
GitHub - googleanalytics/ga4-tutorials
Contribute to googleanalytics/ga4-tutorials development by creating an account on GitHub.
Works fine for me. These are the steps I did
I've repeated every step according to the screenshot above but keep getting this error
maybe the messed something up when it comes to windows. Can check later today when I'm back home and have access to a windows machine
Ok, thank you
The GA4 tutorial itself seems to have some bugs (and in fact there are two bug reports open on that repo regarding this matter). These modifications should be done on
<root>/src/index.ts
file.
The viewPath is constructed from __dirname
using new URL(".", import.meta.url).pathname
. However, on Windows this produces something like "/D:/devel/ga4-tutorials/src/"
. That /D:
doesn't look like a valid path. File Explorer doesn't accept it and opens it in a browser, which proceeds to complain that the path doesn't exist.
A look at Node's issue tracker (https://github.com/nodejs/node/issues/23026) suggests this behavior is in accordance with the spec. The correct way to actually convert this seems to be change that line to const __dirname = dirname(fromFileUrl(import.meta.url))
(import those functions from Deno std), though I haven't checked if it's still correct on a Unix-based system yet.
It's not over yet. Later, there's this line:
The new __dirname
we've constructed does not have an ending slash. This should actually call join()
(again, from Deno std) instead of doing string concatenation. Adding the slash yourself ("/public"
) seems to also work. Maybe.
I actually would go ahead and change the initialization of viewPath
to use join()
instead of string interpolation as well just to be safe, but at the moment it doesn't seem to cause any issues.
Looks like there are similar issues in the index.ts
under the tutorials/
folder as well.Thanks for the answer, I've tried all your suggestions and solution from the bug report on that repo but still getting error message