Setup Node.js issues with Powershell

Scott Parkhurst

Nov 24, 2020, 15:30 GMT+1

I can not get Node.js to work on Atom. Everything worked just like Ivan said right up to when I type code into atom, the code doesn’t change colors like it used to and will not populate on my desktop’s Powershell ISE. it just stays blank like nothing was set from Atom to Powershell. I also could not see how Ivan created the file that he opened with Atom.? was it just a blank text file or what?

1 Like

Hey @Cryptoscoot , hope you are well.

image
You are saving your file with the wrong name, it should be “filename” . “js”, by “filename”: is the name of your file, then “js”: is the format of your file, which should be for JavaScript (js).

Then, you should open a powershell window or a console window (cmd), navigate into your folder which contain your JS file and run the command to start your file. node filename.js

Thank you for responding Thecil.

Yes, I am saving my file as test.js .

I opened my powershell, and it is stating that it is going to Node.js demo file per powershell.
I also tried adding .txt to my file name as you showed me but that didn’t seem to change anything either. Basically I can’t get my code from Atom to Powershell but it appears that Atom isn’t working with my saved text file?

Like Carlos mentioned, run the command node test.js in your Powershell. And you will see the code will work.

Hope this helps.

I am not a tech smart, this is the 1st time I have even seen powershell. all I know is that I have followed Ivan’s steps but the only thing that looks different is the file he saved to open with atom. I could not see what kind of file it was and it looks different than the 2 options my computer gives me.

below is the error message I am receiving. I’m sure it is a simple issue but all I can do is what I think you are talking about because instruction in text form it is all Greek to me. I believe the issue is in creating a new blank file under the Node.js demo file which is what we open with Atom because everything worked great right up to that point and when I enter any code in Atom it doesn’t change the commands to a color and if I still push it through I get the below error message

My new file options from my computer are to create a text Doc. or a Rich text Doc. Ivan’s saved file had some kind of little symbol on his file like when you open a file in Adobe, it has a little adobe icon on the file. I don’t have any icons on my saved files no matter which one I save it to, they are just blank text pages.

yeah, I have tried many different variations of saving and naming the file and I can not get the error message to stop.
I’m probably not understanding what you asking because I don’t know all the terms you and Ivan use so I just follow step by step what he does and the one thing that’s not in the screen in the video is when he created the file named test.js, I couldn’t see what kind of file he chose to use to open in Atom.

i’m thinking I will need to sownload something to give me the option to create a js file or something.?

please advise further.

1 Like

If you have installed NodeJS already, you are just missing the keyword node at the start of your command, which should be node test.js

That means in simple terms ‘run NodeJS and start these file’ most of the programs have their own keyword to star the program. For NodeJS is ‘node’ followed by other options if necessary.

Carlos Z

Yes, I have done that and it does get rid of the error message but it still doesn’t type “Hello” in the Powershell like Ivan’s did through Atom.
I believe that has something to do with the fact that when I type in Atom the code doesn’t have colors for the commands like it isn’t recognizing (console.log) and stuff.?

Please advise further.
Thank you again Thecil.

1 Like

Your file have the wrong name, “test.js.txt” should be renamed to “test.js” then try to run it again in the powershell.

Carlos Z

Yes, that’s what it is named.

For some reason it adds the .txt to it because the blank file that I am using is a text file.
Again, I believe this is the problem because Ivan’s blank file had an icon over his file that stated it was a js file and I don’t even have that option when I go to create a new file. I only have a text or rich text to choose from but either way I have tried both and neither one work.

Please advise further.

Thank you. :slight_smile:

1 Like

Ok, I think you create a text document and then code on it with atom.

Now you can rename de file through atom, right click on it and ‘rename’
image

You could also just create a new file in atom, then save it with the proper file format (.js) at the end.

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

Okay, that worked to fix Atom, (the color code is back but it is still not working in my Powershell.

see attached.

I did notice that if I enter “ls” (list) i get node.js demo and not test.js like Ivan did. I have the test.js file saved within the node.js demo folder. I don’t think that made a difference but just trying to get everything out there so we can figure this out. I have tried saving it beside the node.js demo folder with still no success. (see below)

Oh, I also noticed that I now have a little icon on my text file so it looks more like Ivan’s now so i think we are getting closer to figuring this out. :slight_smile:

Please advise further.

Thank you.

Ok, I have waited long enough, I am going to continue forward with the classes and I will continue to do it the old way till I hear back from someone that can fix this issue.

Thank you.

nevermind, it just worked for some reason. the same thing we have been doing over and over again to no a vale is now working. smh. lol