-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
deno install -g
doesn't auto-discover config file in local directory
#27499
Comments
I think this is #17855 ? |
deno install -g
doesn't auto-discover config file in local directory
Or #17572 ? |
I think those issues are related, but I notice that their justification for not using a config file for globally installed commands mention things like TypeScript config, linting and formatting. My main issue has to do with using the 'imports' section of my config since my libraries don't normally use relative paths, but instead use the same syntax that users of my libraries would use, i.e. something more like I also wonder whether installed commands shouldn't result in files being copied to my ~/.deno/bin folder rather than just being referred to. It would definitely result in more disk space being used, but would allow me to remove the project folder entirely while still allowing the installed command to continue functioning. And then there's the fact that if I include the config option when installing a command, it copies my deno.jsonc file, but names it something ending with .json - that's just really odd. |
Version: Deno 2.1.4
Using Windows 11
I've posted a question on stackoverflow, at https://stackoverflow.com/questions/79317608/deno-2-configuration-file-not-detected-when-using-compile-command that may explain further
But, here's the jist. If I run
deno install -fgA src/bin/compile.js
with the current directory set to my project directory (~/vllu below), the files added to my ~/.deno/bin folder include the --no-config option, even though my project root contains a deno.jsonc file. FYI, my directory structure is:And I ALWAYS leave the current directory at my project root (i.e. ~/vllu)
The docs I see when running
deno compile --help
clearly state that the config file should be automatically detected and used. But that's not all. Since there is a --config option for specifying the config file to use, I tried usingdeno install -fgA --config ./deno.jsonc src/bin/compile.js
which resulted in this odd behavior:
my config file was copied to the ~/.deno/bin directory, which is odd because the script being installed is NOT copied, but used directly, i.e. if I make changes to compile.js, the command would use those changes, but if I make changes to my deno.jsonc file, those wouldn't be used because the file is copied.
the copied file has the file extension .json even though my config file is named deno.jsonc. It is, in fact, not a valid JSON file since it contains comments and trailing commas. Attempts to load the file as a true JSON file is bound to fail.
Then, after executing the above install command, I found files
compile
andcompile.cmd
in my~/.deno/bin
folder:I'm not sure why I need both, but anyway... when I try to run the command
compile llutils
(my compile script automatically finds the location of the src/lib/llutils.js file), I get the error:$ compile llutils
error: Module not found "file:///C:/Users/johnd/.deno/bin/src/lib/llutils.js".
at file:///C:/Users/johnd/vllu/src/bin/compile.js:7:9
The file path it's looking for is entirely wrong. It seems to be looking for src/lib/llutils.js in my ~/.deno/bin folder. FYI, the compile.js script is importing from
'@jdeighan/vllu/llutils.js'
and the config file contains:"@jdeighan/vllu/": "./src/lib/",
in the imports section. I'm guessing that Deno changes the current directory, which would, I think, cause the bad file path. If Deno is going to change the working directory, it should modify the relative paths used in the config file.
Also, I tried changing the copied config file extension to
.jsonc
, and also changing that file extension in both the filescompile
andcompile.cmd
, but that made no difference. Perhaps deno loads it as a.jsonc
file, even if the extension is.json
, which I find very confusing.The text was updated successfully, but these errors were encountered: