JavaScript Programming Beginners 'Hello World'

Hello,

I’m following everything step-by-step on the videos however, my screen doesn’t look the same. I get a lot of errors.

Please view:

I get this…

As oppose to this…

Also, I come across technical difficulties that do not allow me to move forward. Please help…

The one from the video look like…

Lastly, how do I make the code live and running? Mine shows this…

Can some please help and explain for the full understanding? I’d like to move forward.

Thank you,
Loren

1 Like

The warning and the errors your are getting are from the website you are inspecting it is not from you. You can ignore it. Or you can hide it.

You are most likely trying to run the wrong file.

  • Make sure you are in the correct directory.
  • Make sure you are trying to run the correct file name.
  • File and directory names are case sensitive.

Hi Maki,

Thanks for helping replying to me. I have a few more questions:

  • How do I know which file? I looked for the file and its in the same folder.

  • Where is the correct directory? How do I locate that?

This is what it still shows:

…and here is where I located the file:

Thanks again in advance,
Loren

I am looking a different error now, I think you run the command before you save your change. The reason you are getting ReferenceError: document is not defined,document relates to the DOM (Document Object Model) in a web browser. Node.js, however, is not a browser environment.

1 Like

To check what directory you are currently in, use the folowing in your terminal.

# In Linux/Mac
pwd

# In Windows
echo %cd%

To see what files and directories exist in your current directory use the following in your terminal:

# In Windows
dir

# In Linux/Mac
ls

Hi Maki,

I might seem computer illiterate… but these were all the attempts I tried… Am i suppose to input in the terminal like this:

The files looks like I’m in the correct file. But I don’t know if I am reading it correctly.

Yeah it looks like you are in correct file🤔, but here you were in different file

that was the reason you were getting Can find module error. Now you are in the right file it should work, can try running the command again.

1 Like

Hi,
Could somebody please help me here… I’m not sure what I’m doing wrong.

I have installed node js and checked that it has been installed correctly using as below
michaelskiffington@Michaels-MacBook-Pro MORALIS % node -v
v16.13.2

I have followed the instructors lead and can’t see where I’ve gone wrong apart from not using Powershell (haven’t got it) but apparently thjis shouldnt be a problem.

Any help would be greatly appreciated… Im a total novice when it comes to javascript

The reason for this error is because you are in wrong directory. The hello-moralis.js file is inside the Moralis Js directory, So you have to be on the Moralis Js directory, to do that you can run cd Moralis Js and try to run node hello-moralis again it will work.

Sorry could you please spell that out like your talking to a baby… I’m a total beginner when it comes to javascript
I’ve tried a few times and its telling me “command not found”

michaelskiffington@Michaels-MacBook-Pro Moralis % cd Moralis JS
cd: no such file or directory: /Users/michaelskiffington/Desktop/JS
michaelskiffington@Michaels-MacBook-Pro Moralis %

Im now getting the error above

Can you run ls and send me what you get.

Hi Maki,

Please see above as requested

Thanks for your help

1 Like

okay, can you run cd Moralis\ JS and then run ls again and send me back what you got too.

Hi Maki

Please see below

Now run node hello-moralis.js , it will work.

Thanks Maki its working now

1 Like

So I was able to follow your previous instructions on changing the directory. Thank you for that! however now when I type node hello-moralis, nothing happens.

Can you please explain why this is happening?

Thank you for your help!

It looks like you run the command before you save your changes.

Hi everyone.

I am just beginning the course “JavaScript Programming” and can’t get beyond the first part of reflecting “Hello Moralis” in the terminal.

What appears is as follows: (Module not found).
Appreciate any help please as I do not know what is wrong. I would love to move forward.