Skip to content
Discussions/App Development/Problem with defining the module nameForum ↗

Problem with defining the module name

App Development8 posts293 views8 likesLast activity Sep 2021
AL
AliceOP
Sep 2021

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. Schermata 2021-09-22 alle 19.25.11

LE
Leonid_Rozenberg
Sep 2021

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?

CO
cocreature
Sep 2021

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?

AL
Alice
Sep 2021

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.

CO
cocreature
Sep 2021

You have a typo, it should be ContractId not contractId.

AL
Alice
Sep 2021

Thank you so much for your help! I really didn’t see that mistake.

QU
quidagis
Sep 2021
Alice:

I would try the cat thing, but I don’t know how to do it.

Ah cats! :grinning:

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 :grin:), please ask.

AL
Alice
Sep 2021

thank you so much!

← Back to Discussions