I am currently trying to make my app server run indefinitely with forever and nodemon. To do so, I am using the following command:
forever -c nodemon --exitcrash app.js
the problem is that the presence of forever module seems to affect the display of my app. Namely, whenever I run the app using forever, my login window styles are changed and the entire thing is shifted to the left side of the window. What is more, some of the app routes stop working. On the other hand, whenever I use a simple npm start or nodemon command, it works as expected.
Does anyone know why this may be happening? How could I make the server run continuously and not mess with the app itself?
P.S. It may be useful to mention that for some reason, my app only works upon running npm start and does not work properly when node app.js is run. I am unsure why that happens.
Related
My goal is to modify the Minio browser for front end appearance in house. I'd like to add features too but can't seem to get either to work and feel like I'm missing something about how go accesses npm or the browser.
I have made changes to the Minio web browser (javascript) and can see them when running with npm (in ./browser 'npm run release;npm run dev'), but when I try to run minio server built with the same git clone (changes is browser subdir) and browse to localhost:9000 I don't see any of the changes.
It would also be nice to run the browser with npm and connect to the running server "./minio server ~/data", but they don't seem to talk and I'm unclear on how they're connected.
This seems to be a simple case of all the things I tried and in the right order.
Correct order:
cd browser; npm run release
cd ..; make
./minio server ~/minio-data
It seems I'd tried all of these separately but not in the obvious order. I'm assuming npm makes the ui-assets.go which gets included by the make
I installed the vue-CLI node module. Then when I cd to my node project and type npm run serve it gets to around 27% building and stops. It also seems to be a different module that it stops building on. No error is thrown either, it just says 'building' but the percentage doesn't go up.
Has anyone else had this? I can't find a solution anywhere.
EDIT:
This is what the command line says when it stops building
INFO Starting development server...
20% building 89/99 modules 10 active ...odules\vue-hot-reload-api\dist\index.js
It seems to consistently be vut-hot-reload-api that causes it. Any suggestions?
I am trying to deploy a small Node.js application to Heroku, and then have the Heroku Scheduler run the application every 10 minutes. Our customers former supplier who built this application also hosted it on Heroku, so there should be no need to change anything in the sourcecode, that I have received. Nevertheless I am getting the following error from the Heroku log.
2018-05-09T07:26:07.710882+00:00 app[api]: Starting process with command `fetch` by user scheduler#addons.heroku.com
2018-05-09T07:26:11.124833+00:00 heroku[scheduler.2653]: Starting process with command `fetch`
2018-05-09T07:26:11.718182+00:00 heroku[scheduler.2653]: State changed from starting to up
2018-05-09T07:26:13.647479+00:00 heroku[scheduler.2653]: State changed from up to complete
2018-05-09T07:26:13.629258+00:00 heroku[scheduler.2653]: Process exited with status 126
2018-05-09T07:26:13.542885+00:00 app[scheduler.2653]: bash: /app/bin/fetch: /usr/local/bin/node: bad interpreter: No such file or directory
Apparently there's an issue with the 'Shebang' line in my fetch file which runs my index.js file:
#!/usr/local/bin/node
var path = require('path');
require(path.join(__dirname, '../index')).start();
I am rather new to Node.js and Javascript, so I'm not sure I fully understand the purpose of the 'Shebang' line. But I'm guessing it is pointing to a wrong location or something like that? How do I figure out, what to change in this line?
Shebang line tells which interpreter to use to run the file. Error you receive tells that node is not installed in location shebang points to. Using #!/usr/bin/env node usually works.
You should not have a need for any "shebang" line in your "fetch" file.
I suggest you simply remove the #!/usr/local/bin/node line, and specify the following as your Heroku Scheduler command:
node <path_to_fetch.js>
That should get heroku scheduler to launch your node.js app in a one-off dyno, provided you have a node.js buildpack in your app.
Use the instructions here to check if you have a node.js buildpack in your app, and to add it if necessary.
That said, if you really want to run your app with a "shebang", change it to #!/usr/bin/env node. In that case, omit the word node in your Heroku scheduler command.
nodeJS file — main.js
Have a website with button which can call function from main.js. I not know how restart nodeJS script correctly. Now I run process.exit() in main.js and then, with nodemon trying restart application but nodemon tell me “[nodemon] clean exit - waiting for changes before restart”. So how correctly restart application?
Clean exit means exit code 0, which means, "Everything is okay! I intended to exit." Usually, programs that exit normally don't specifically intend to be restarted. nodemon is choosing to consider that the end of the program's operation, which isn't a totally insane thing. However, nodemon being a process manager for daemons, probably ought to just restart it anyway. I would suggest using PM2 instead, it is what most people use in production and it will correctly restart the process since its whole job is to keep services running.
Aside from all of that, I want to note that allowing a browser to restart your app is probably not a good idea. If you have carefully designed your app to be stateless and handle random shutdowns and it is clustered, etc. then maybe it is fine. But generally I would not recommend it. At the very least, make sure the request is authenticated and authorized.
I have this program where a server is made. Before the server can start though I need to register it. This is a one time thing as re-registering it will change all the dcom data and settings to factory settings. Which I don't want. So What I have set up is a JS file that runs my program and gives it a parameter argument "register" which is handled in my program to register the server. Similarly before uninstalling I want to run a similar JS file that passes an unregister argument so the server is no longer listed on client views after it's been removed. To be clear I have both of these JS files working fine and they successfully register/unregister my server as needed.
My issue is that I've added these files in the application directory and in my Visual studio installer: Setup Project, I have gone to right click installer project > view > custom actions. Then I right clicked the install folder and added my regserver.JS file and similarly for uninstall I've added my unregserver.JS file. The problem lays in the order that these get run. When the intaller runs it first run my regserver.JS. This is bad because there is no .exe of my program existing yet so an error is thrown... Is there a way to specify in my project that this JS is only to be executed AFTER the installation finishes?
Or is there a clever wrap around to this? Maybe I'm doing it all wrong!
EDIT: ..just an idea... what if I make ANOTHER two JS files that delay for like 30 seconds while the installer runs and then they execute my regserver/unregserver files... Really sloppy but I mean it might work...