Sails Project is Not Working - node.js

Sails project is not working. After sails lift command from terminal. I did run the project through the localhost: 1337 port from browser. But its not loading, browser screen is blank. And there is no error message in terminal.
Note: The same project had run very well before few hours in same machine

Related

Run angular 2/4 application permanently on live server

Hi i want to know that how to run angular application permanently. means if i run the npm start command on local server. then after it gives a url with port like localhost:4200. but when i close the terminal then my project not run.
Same thing happen with me on live server when i run my command through putty.
ng serve --host {ipadddress}. then it gives me a URL like mysiteip:4200. but when i close putty my site not run. i want to know that how to run angular application permanently.
You could just send process into background by adding &
You can use
forever start node_modules/#angular/cli/bin/ng serve --host {ip_address or domain} --prod
Reference - https://github.com/angular/angular-cli/issues/4951
Instead of this, You can build your app and just drop everything you got in dist folder of your angular app into the directory of the hosting platform.
I would recommend the screen command on linux/unix systems
screen
// New shell opens
ng serve --host {ipadddress}
// Now putty can be closed
This is a terminal that persists and can be continued.
screen -r
// Lists all active screen sessions
screen -r SCREEN_TTY_NO
But I would advise to not use this in a productive environment.

How to really debug node.js app?

I installed node-inspector.
I run it: node-debug app.js
But it opens the empty browser.
If I try to run node.js in debug mode before: node --debug app.js
It kind opens my scripts in browser.
But it's still not clear how to make it work. What to do next? Which url to use to see the working app itself in browser and trigger app to go to breakpoints?
My express app is usually running under localhost:3000. Should I run this url? It's not working.
Thanks
Okay,
I was able to figure it out. The problem was my app is Express based and it's a little bit different. For some reason it's not easy to find these differences until you start digging into every details. There is the instructions how to run debugger if you app is working under Express.
Prerequisites:
Windows 7
node.js app based on Express
Now:
Step 1. Run app in the debug mode (staying in the folder where your app.js located in the first command prompt), do either of 2: node --debug app.js or node --debug bin/www.
Step 2. Open the second command prompt and run node-inspector bin/www (or node-inspector app.js)
If you see the error that it can't access port 8080 it means that something is already listening to it. So you need to run this command differently: node-inspector --web-port=8099 bin/www
After step 1 you will able to run your app as usually in browser: localhost:3000.
After step 2 you open another browser window and enter: http://127.0.0.1:8099/?port=5858

Unable to start the nodeapp through terminal

I have a node app locally and I normally run it using the run button in the web storm, which works fine. While I am documenting the project I came across this blocker: if I try running the same app through the terminal using the command: node app.js , the server starts but the browser throws and error stating "This site can’t be reached" "localhost refused to connect".
Because the port is occupied.
You can change it using app.listen({port})...
or
linux:
export PORT=4500
node server.js
windows:
set PORT=4500
node server.js
I found this myself.. since I used the scaffolding app and it stores info related to server at bin/www, so we will not be able to run the app using the command : node app.js but instead we could run the app using nodemon(which I installed globally on my machine)
Love nodemon for this awesome feature <3 :)

Nodejs webstorm socket.io wont start in debug mode

I have a nodejs application and its working with socket.io
I have the currect configuration in webstorm
when running the application it works and show in console: info - socket.io started
but when starting application in debug mode, wont show this line and socket does not start
whats the problem?
evebn thought I have nodemon and in nodemon this happens the same

Sails.js is not working with forever

I m new on both sails.js and node.js.
I created a simple api with sails.js. It works fine when I start it with sails lift --prod. On the other hand when I start the application with forever start app.js --prod and it always returns 0 altough I dont not get any error and warning and I can see my app.js in the list with the forever list command.
I created a simple node.js application to test forever and it worked as expected.
I tried to run my Sails.js application both my local windows and linux/ubuntu machine on digital ocean, they worked fine with sails lift but not forever. Also I tried node app.js --verbose and it was ok. My sails version is 0.11.4. Thanx for your help.
Well eventually I start my application with forever. Those are what I did
I checked forever commands and saw logs command which provides running forever applications log files.
When I checked the log file under c:\users\user-name\forever I saw a warning about Sails migrate settings should have been done.
Then I read this documentation about Sails migrate settings and I set my project as migrte: 'safe' .
Now it works fine.
Your error is similar to this: Cannot run with forever js
I think, you should open config/models.js and add migrate: 'safe'.

Resources