Problems instaling Crystel 1.12.1 in windows 11

Well this is the error I got from trying to execute crystal in VS Code for the 15th time, I installed the windows SKD, the Visual Studio and the extension on VS Code,I tried it without it, I even installed the installer 4 times and the RAR file 2 times and I don’t know what to do any more, so I came here.

The Code is just:
puts “hello world”

The error

[Running] crystal "c:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"
Error executing process: 'C:\\Users\\user88\\AppData\\Local\\crystal\\cache\\crystal-run-Se.exe.tmp.exe': The system cannot find the file specified. (File::NotFoundError)
  from D:\a\crystal\crystal\src\crystal\system\win32\process.cr:292 in 'spawn'
  from D:\a\crystal\crystal\src\process.cr:272 in 'new'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:269 in 'execute'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:243 in 'run_command'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:55 in 'run'
  from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
  from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
  from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +87264 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +18523 in 'RtlUserThreadStart'
e[31;1mError: e[0me[1myou've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issuese[0m

[Done] exited with code=1 in 2.234 seconds

What I have noticed is the compiler seems to create the file because I caught it happening the two times I was watching the file, but after that it just uninstals it almost immediately. Also, it didn’t create an environment variable even though i every time I installed it I enabled it.

The more I search about it seems to be about my installation being corrupted but I dont know what to do. Anyone can help?


I don’t even have a Disk D and this was what i got from trying to initialize the program directly

Hi @Looceri , if I understand what you’re doing, you’re running crystal Se.cr, is that right? What happens if you do crystal build Se.cr?

It works but only when i do it in the command prompt, thanks. But is there a way form me to use it in a IDE instead of the command prompt.

That means if you call crystal Se.cr it works too?

Not in the command prompt, unless you are talking about the crystal.exe but unfortunately the crystal.exe opens and immediately closes, so i don’t know.

What happens if, in the terminal, you write crystal "C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"?

I mean in the command prompt

It returns this error:

C:\Users\user88>C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr
Error executing process: 'C:\\Users\\user88\\AppData\\Local\\crystal\\cache\\crystal-run-Se.exe.tmp.exe': The system cannot find the file specified. (File::NotFoundError)
  from D:\a\crystal\crystal\src\crystal\system\win32\process.cr:292 in 'spawn'
  from D:\a\crystal\crystal\src\process.cr:272 in 'new'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:269 in 'execute'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:243 in 'run_command'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:55 in 'run'
  from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
  from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
  from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +87264 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +18523 in 'RtlUserThreadStart'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

So the problem is running the program from within the compiler, but building the program works well. I’m afraid you’ll have to use crystal build and then run the .exe from the command prompt until we find out what can be the problem. Can you add an issue in the tracker? Thanks

Well the thing is it does build and run but only when I specify for it to run.
Here it works:
Input:

C:\Users\user88>crystal run -d "C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"

Output:

Hello, world!

Here it doesn’t:
Input:

C:\Users\user88>C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr

Output:

Error executing process: 'C:\\Users\\user88\\AppData\\Local\\crystal\\cache\\crystal-run-Se.exe.tmp.exe': The system cannot find the file specified. (File::NotFoundError)
  from D:\a\crystal\crystal\src\crystal\system\win32\process.cr:292 in 'spawn'
  from D:\a\crystal\crystal\src\process.cr:272 in 'new'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:269 in 'execute'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:243 in 'run_command'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:55 in 'run'
  from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
  from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
  from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +87264 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +18523 in 'RtlUserThreadStart'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

I don’t know why, but thanks, at least I found a way to run the code.

How do I add an issue in the tracker??

Let me see if I understand:

This works:

C:\Users\user88>crystal run -d "C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"

But this doesn’t:

C:\Users\user88>crystal run "C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"

Regarding:

How do I add an issue in the tracker??

The simplest option is to go to Sign in to GitHub · GitHub but if you don’t have a github account I can do it for you.

Exactly

Just finished posting the issue, thanks!

2 Likes

@Looceri It’s a bit hard to grok what exactly is going on. I hope you could help me understand the problem a bit better.

Please give specific details about what you did and how you did it. Could you clarify these questions?

  • Which extension did you install in VS Code?
  • I gather the first error message is output from a runner in the IDE? How exactly did you run that?
  • You mentioned that crystal build works. Does it produce a working executable?

And please use code blocks to highlight error messages and command prompt data
You can wrap pasted output with lines consisting of triple backticks (```) to get a nicer formatting.

That’s very suspicous. I don’t think the crystal compiler can be responsible for directly removing the executable after building it.
By chance, do you have some kind of anti virus software running on your system? This might be a cause of interference if it incorrectly identifies the executable as a threat and removes it (or puts it into quarantine or whatever).

Which environment variable did you expect to be set where?

Those paths related to the source locations of the compiler, which was build on a different machine. I suppose it’s confusing to bake in the full paths there. But you can just ignore this.

Regarding:

Regarding:

I already had the code runner installed since it mentioned Crystal as one of the languages it should run, so I just used the CTRL+ALT+N


And I got this

[Running] crystal "c:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr"
Error executing process: 'C:\\Users\\user88\\AppData\\Local\\crystal\\cache\\crystal-run-Se.exe.tmp.exe': The system cannot find the file specified. (File::NotFoundError)
  from D:\a\crystal\crystal\src\crystal\system\win32\process.cr:292 in 'spawn'
  from D:\a\crystal\crystal\src\process.cr:272 in 'new'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:269 in 'execute'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:243 in 'run_command'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:55 in 'run'
  from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
  from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
  from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +87264 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +18523 in 'RtlUserThreadStart'
e[31;1mError: e[0me[1myou've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issuese[0m

[Done] exited with code=1 in 6.644 seconds


And I also tried using the command pallet doing this

C:\Users\user88>C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr


And this

C:\Users\user88>crystal run C:\Users\user88\Desktop\UEM\Disciplinas\LPC\Crystal\Se.cr


I pretty much got the same message

Error executing process: 'C:\\Users\\user88\\AppData\\Local\\crystal\\cache\\crystal-run-Se.exe.tmp.exe': The system cannot find the file specified. (File::NotFoundError)
  from D:\a\crystal\crystal\src\crystal\system\win32\process.cr:292 in 'spawn'
  from D:\a\crystal\crystal\src\process.cr:272 in 'new'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:269 in 'execute'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:243 in 'run_command'
  from D:\a\crystal\crystal\src\compiler\crystal\command.cr:55 in 'run'
  from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
  from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
  from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +87264 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +18523 in 'RtlUserThreadStart'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

And it only worked when I did this

Regarding:

Well that is because I saw it creating an exe, but it got deleted almost immediately as the screenshots show



Regarding:

The thing is I had one AVAST, it complained at first, so I deleted it whilst talking with a friend about it but after that the error still continued, so I came here. So I just tried deactivating windows defender real-time defence and I put the directory as an exclusion, but it still gives the error.
So for now, I don’t think that is the case because at the before last screenshot at the previous topic, it had written the error before getting in the directory. But I’ll keep that in mind and see if there isn’t anything that I am unaware of regarding that.

Regarding:

I didn’t really have any environment variable in mind, I just noticed that it was one of the checks in the installation of crystal and that it doesn’t seem to appear here:
Screenshot (6850)
Unless I’m mistaken.

Regarding

That’s good to know.

Well I hope I’ve been sufficiently thorough with my explanation, if that isn’t the case you may correct me once more.

Okay, thanks for the clarification :+1:

So something must be removing the executable directly after it’s build. I doubt it’s the compiler itself.
Ideal would be some kind of watcher for file events to log which processes write to the path. I have no idea how to do this on Windows, though.

Just double checking what happens with crystal build Path\To\Se.cr? Does that produce an executable which won’t be removed?
What if you run crystal build Path\To\Se.cr -o C:\Users\user88\AppData\Local\crystal\cache\crystal-run-Se.exe.tmp.exe (i.e. the same output path as crystal run writes to).
If it’s something outside the compiler, it should be expected that this explicitly targeted file might disappears as well.

can you try applying this: Apply a basic audit policy on a file or folder - Windows 10 | Microsoft Learn to the AppData\Local\crystal\cache folder?

I haven’t test it yet but supposedly it will log some event whenever a delete event happens

1 Like