In the Full Stack JavaScript Development with MEAN book, I have installed Node.js and went through the REPL command on page 19/20. I am using Sublime Text 2 as my editor and I created the app.js. When I try to open the URL for the node.js server (http://127.0.0.1:1337/) through Firefox on a Mac, I get “Unable to connect.” Where does this app.js need to be so the server will start up? Do I need to copy files to the folder where I have the app.js? I am beginner to Node.js and MEAN stack development.
Hi Dan, just open a terminal in the directory where your app.js file lies and type node app.js to run that server. If something goes wrong, you should get an error message which you could post here – otherwise, you should be able to connect as described.
I have exactly the same issue as dzeller. I know my code is correct. Opening the app.js file from the console, I get this error
Script: F:\app.js
Line: 1
Char: 1
Error: Object expected
Code: 800A1318F
Source:Microsoft JScript runtime error
I have tried the same by placing the .js file with in the Node folder and get the same issue.
As I literally just noticed, I did not type ‘node’. The instruction was a little obscure in saying to type that. 'Type “node app.js” ’ would have been better. All works. 100%. Thank you for at least having told me what it was I had done wrong