Hi everybody! I’m having some troubles in defining the module name on VS Code. I’ve created a file named “CreditCard.daml” and as module I’ve written “module CreditCard where”. At first VS Code was displaying an error but after a while it was not displaying it anymore. So, I went to the terminal to build a dar file with the command “daml build”, but it says that it’s not possible because the module name is missing.
I really don’t know what I’m doing wrong and I hope that one of you can help me with that. Thanks in advance.
Hello @Alice. This is a bit of a long shot but are you sure that the file is saved? There have been times where due to vscode’s caching mechanism it shows the file without any changes, such as when you copy and paste, but it has not actually been written to your hard drive. If you cat
the file in your terminal does it have module CreditCard where
at the top?
To double check @Leonid_Rozenberg’s theory, can you show us the output of cat daml/CreditCard.daml
run from the same terminal where you ran daml build
?
Thank you so much for the help! After restarting VS Code many times, I was able to make it work. But now I’m working on another contract and module is giving me different problems. I would try the cat thing, but I don’t know how to do it.
You have a typo, it should be ContractId
not contractId
.
Thank you so much for your help! I really didn’t see that mistake.
Ah cats!
What @cocreature meant was to open a Terminal in your Desktop (Which I am assuming is a MAC), change to the main directory of your newly created Daml app, and execute the cat
(Which is short for Concatenate) command and view the contents, if any, of the daml/CreditCard.daml
file.
To do that, do this:
# Change to your Home_Directory
$ cd
# Change to your new Daml app
$ cd /path/to/your_new_daml_app
# Example: if your Daml app is in your Projects folder
$ cd Project/your_new_daml_app
$ cat daml/CreditCard.daml
To learn more about the Command Line on MAC, try => this
There are a lot of MAC users in this forum (Not me ), please ask.
thank you so much!