I was developing a different app titled "Video Chat" around 5-6 hours ago and after my work was done I switched over to a different app and ran it using the "npm start" command, however the command now only starts the "Video Chat" app in the localhost and I'm stuck here. Any suggestions? Both applications were created using ReactJS.
The problem persists even after I've deleted the "Video Chat" application, reinstalled Node LTS version and even changed the partitions of the project I'm working on now. I want to run my current application on the localhost for development.
npm start depends upon what is written under package.json file on start property on scripts object.
Go to task manager and stop the node engine. And start your application in a new terminal. It always happens due to the cashes of the current engine. Once you stopped the node in the background process, it will load your command next time in a new node engine.
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 have a working react app that I had hosted on a linux environment, but the client has switched their hosting provider and now I have to run the app on a Windows environment. I personally am unfamiliar with Windows and having some serious issues getting my app to work now.
After loads of debugging and testing I now can get my app to run, but when I start it, it will throw some errors which will results in a broken app in the browser.
So when I run npm start it will start up the app and spit out this error:
Screenshot of the terminal error 1/2
Screenshot of the terminal error 2/2
It seems to spit out some complaints when using npm run watchJS which runs this command babel src --watch --out-dir lib.
I am completely lost at this point and have no idea where to go from here.
I can provide as much detail as anyone needs after looking at the question, I just don't know what else to add to this issue and don't want to fill up this question with irrelevant info.
Thanks in advance for any help
It is likely a bug with the version of npm you are using.
See this thread:
https://github.com/npm/npm/issues/18380
Try rolling back your version of npm to 5.3
The issue appears to be exclusive to windows with babel packages.
I am very new in Node.Js. I just started node.js basic tutorial. But when I change my code I have to restart the server all the times. But is there any way where no need to restart the server again and again.
Nodemon is the best solution for this.
Install nodemon like this "npm i nodemon"
Then restart your project with nodemon, "nodemon app"
You are good to go...
You can install node-supervisor to restart automatically your server when you change the code.
I'm not sure on the details of the compilation process. But I think it's correct to say that on app start, your source code is parsed into computer instructions represented in memory and executed. During runtime source code files are not re-parsed. And so changing the source code will have no effect on the running application. Unless the application re-parses a file prior to execution of the code in that file. Possibly a service worker... But I'm not sure and that would be an exception.
A good way of thinking of nodejs and javascript files (imo) is that the javascript files are configuration for nodejs. Which is a c++ app. So if the configuration changes you need to restart node to read the new configuration.
There are tools such as nodemon that will monitor the source code for file saves and trigger the node application to restart.
Check out Nodemon.
nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application.
nodemon does not require any changes to your code or method of development. nodemon simply wraps your node application and keeps an eye on any files that have changed. Remember that nodemon is a replacement wrapper for node, think of it as replacing the word "node" on the command line when you run your script.
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.