I am relatively new to using React and am following create-react-app tutorials. I am creating a simple webchat service using socket.io, React, and Express in a Node environment.
I've finished writing the majority of the features for the React app and am now working on the server end to connect the apps via Socket.io. Working on the front-end was each because I could just run "npm start" to serve a dev version of my app. However, now that I am working on the server side, implementing Socket.io, whenever I find an issue on the front-end, I have to rerun "npm run build" which takes ~15-30 seconds each time.
I am sure there is a faster way to debug issues like this without having to compile my react app into static files every time. Please advise.
You should run the front end using npm command on cmd panel npm start and debug the backend server side using VSCode Debugger using the node js extension. This way you can run both on dev easily. Plus it give you advance debugging features.
Related
We are using node server to start our angular application using npm run. Due to strange reasons application is taking lot of time to render on browser whenever there is a change and angular build runs.
If there are no changes/ no angular build is run, if we reload the page it loads fast.
We are suspecting the issue is with node and want to run the angular application standalone using ng serve. But running this command is just building but not starting the server.
Need guidance on how we can keep node and run the angular application fast on browser. If not, please suggest where to look if I had to fix ng serve command to start the angular server as standalone
I've only start learning vuejs recently and I'm trying to build a real-time messaging apps. I was following this tutorial and able to get the nodejs server running but it would require me to use the command "node myapp.js" every single time and I can't run my vuejs apps after running nodejs server unless i stopped it with ctrl+c and type "yarn serve" again. How do I run the apps and trigger the server at the same time? I would really appreciate suggestions, thanks :)
You could try either of these packages:
npm-run-all
concurrently
Or just open up two console windows 😆
Try something like Node Foreman
I am using Angular Universal Starter repo. In angular 4 universal for ssr we could debug browser and node part of application in dev mode(see console), but now I do not see way to debug node part. I tried to execute ts-node server.ts with some changes( paths to files, etc), but angular seems needs aot compiled app and
throw Error: You must pass in a NgModule or NgModuleFactory to be
bootstrapped.
from docs:
Development (Client-side only rendering)
- run npm run start which will start ng serve
Production (also for testing SSR/Pre-rendering locally)
- npm run build:ssr && npm run serve:ssr
At first glance debug on Node.js in development do not work. At least from the box. May be someone resolve this issue.
You can't debug node part of your Angular 4 app in browser. Node work on server part so you can't see this in browser (client side).
Only way to debug this part when you start it from ts-node server.ts is to use external tools like WebStorm etc. If you start your App in TS mode from Debug mode you can use all features of this tools.
I think this small piece of code can help you
create the project
ng n debuggable-universal-server --interactive=false
cd debuggable-universal-server
add universal
ng add #nguniversal/express-engine --clientProject debuggable-universal-server
To create the server-side app module, app.server.module.ts, run the following CLI command.
ng add #nguniversal/express-engine
To start rendering your app with Universal on your local system, use the following command.
npm run dev:ssr
In order to debug with node-inspector I need to start my app with the node --debug command. Up to this point I have only used sails lift to start my Sails.js app, so I am unsure of how to start my app using the normal node command.
So you can actually launch a sails project with node app.js --debug if you have sails installed in your project, rather than only system-wide. Go to your project's root directory and run npm install. Sails should already be in your package.json and thus should install to your project directory.
As of Sails v0.10.x, you can do sails debug instead of sails lift.
sails inspect since Sails v1.0
As of sails v1.0, sails debug is deprecated for newer Node.js, and you should instead use sails inspect.
This is documented at: https://sailsjs.com/documentation/reference/command-line-interface/sails-inspect and is presumably done to match the newer node --inspect interface.
Have you tried using node-webkit to run your node.js apps? This is what we use at work to debug our node.js server applications. It is quite useful runtime based on chromium which you can use to inspect your code using familiar breakpoints, stack traces, variable inspection and such without having to rely on node-inspector (which I find hard to use to be honest).
What you do is instead of using console command 'node you-app.js' you set the node-webkit to launch your app, run the webkit then open its console (which is the same as console in Chrome browser) and from there you can open your source files and start debugging like any other client side JavaScript code.
node inspect
You can also use the command line debugger with:
node inspect app.js
This stops at the beginning, so do a continue:
c
And now, when your code with a statement:
debugger
gets executed, you fall into the Node CLI debugger as usual.
Tested on Sail v1.1, Node v10.15.1, Ubuntu 18.10.
nodemon --inspect and nodemon inspect
You can use those to inspect when using nodemon, which automatically reloads the app on file save: Auto reloading a Sails.js app on code changes?
Those options are analogous to node inspect and node --inspect: node inspect works with debugger statements, and node --inspect works with the Chrome debugger.
Especially useful with the "Open dedicated DevTools for Node" feature: Can I get node --inspect to open Chrome automatically
nodemon inspect is a bit annoying as it requires a continue everytime you make any app changes and nodemon restarts the server. TODO find a way around it.
EasyRTC is one of the best available opensource WebRTC solutions that runs in node.js! I have manged to run it on node.js on my system but my application is in Asp.net so I've been trying to run it using under IIS using iisnode! but for some reason I haven't been able to make it work! running this application in node.js i use node server.js to start the server but in IIS when i set the default page to server.js to start the application it wond work!
this is result by using
nodejs:
nodejs result: (working properly)
IISNODE Result:
looks like it's not even running it !
This error is due to lack required module for easyRTC. type in node command prompt "npm install" It will install all dependency module. And after that try to run server. I hope It will work for you.