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.
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.
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.
okay, can you run cd Moralis\ JS
and then run ls
again and send me back what you got too.
Now run node hello-moralis.js
, it will work.
Thanks Maki its working now
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.
hello-moralis.js is inside MORALIS-JS folder not in the root folder, So instead of node hello-moralis
you should write node MORALIS-JS/hello-moralis
, or you can first move to the parent folder where your file is in to do that, first run this command cd MORALIS-JS , and then
node hello-moralis`. Either ways will work.
Thank you for your reply.
I did what you suggested, however it does not return any “Hello Moralis” after running.
Actually, nothing happens per the screenshot below:
Is there something wrong or further I need to write?
Appreciate your help, thanks
it looks like u run the file before saving the change. first save your changes and run the command.