Bitburner

Bitburner

View Stats:
Early hack template error?
I followed the documentation beginners guide exactly, but when I try to run early-hack-template.js I get this error: "Error while calculating ram usage for this script. Identifier 'main' has already been declared (5:22)." What does this mean? How do I fix it?
< >
Showing 1-2 of 2 comments
vassilevb Mar 22, 2024 @ 4:51pm 
When troubleshooting code and asking for help from people that haven't seen your code, you usually need to share the code itself.

Anyway, the errors are also quite useful. In this case, the error is pointing you to line 5. Check line 5. The error is also hinting towards "main" being declared for a second time there. So, you just need to see if it has been unnecessarily declared for a second time on line 5.

If that doesn't help, you'll need to share your code.

I also suggest checking this:
https://www.w3schools.com/js/js_errors.asp
Last edited by vassilevb; Mar 22, 2024 @ 4:52pm
Moderator Abuse Mar 23, 2024 @ 2:54am 
Originally posted by lancelotlegris:
I followed the documentation beginners guide exactly, but when I try to run early-hack-template.js I get this error: "Error while calculating ram usage for this script. Identifier 'main' has already been declared (5:22)." What does this mean? How do I fix it?

You have a duplication of the function main at Line 5.

In the IDE in game if there's no ram count it means the script is in unusable state clicking on the little box will give you the line number where your syntax is incorrect or you've got incomplete statements.
< >
Showing 1-2 of 2 comments
Per page: 1530 50