I have a new project folder configured and running with express.js and the server is running fine on port 3000.
I have installed nodemon globally using the sudo command so I expect I don't need to add this as a dependency or locally within the project.
When installing nodemon there are no errors, however when i fire the command nodemon server.js the command line essentially doesn't do anything and stops accepting commands.
I'm wondering if I'm missing something and hoping someone can point me in the right direction.
Thanks in advance for your time.
Use npm install -g nodemon this command to install nodemon globally and try to run nodemon [your node app]. For better understanding go through link.
Evening all, thanks for your contributions earlier, essentially things were mixed up with the course since the updates which was causing my issue.
Previously it looks like you would install express and run server.js through your designated port and then boot up nodemon. This no longer works and was causing the issue I was having.
Now you simply just boot up nodemon via the command nodemon server.js and it handles the rest. This wasn't really outlined in the documentation.
I was expecting to boot up localhost and then use nodemon to watch for changes. Looks like the new method is much more efficient
Thanks for the help
Related
I am working on building a RESTful API using Node, express, and MongoDB.
During the beginning stages of this project, when I attempt to run the "npm start", I get a few lines of errors.
The errors I'm getting
I'm not sure what the problem could be as I have added the "start" under scripts in the package.json file and I have initialized node and well as having installed nodemon. Please may I ask for assistance?
Try the following:
Make the file index.js
Try the command node app.js, if it works then your node_modules is in the wrong place or you dependencies are probably not installed properly.
Try uninstalling and installing dependencies.
https://github.com/gleitz/mahjong
I want to run this app on my windows,
the directions say:
-Install dependencies with npm update
-Start the application with node app.js
it's sound easy so I try myself.
1.Fist of all , I install node.js on it's official website (https://nodejs.org/en/)
I download the 8.9.3 version.
after installing node.js
2.open the command line and go to the project path.
3.then I input the command npm update.
it works,and the node_modules folder is created.But there are some warn message
4.finally input the command node app.js... it's not work with many error message
following is wrong message
I wonder know how should I do.Is any thing I didn't installed?
Please help me.I really want to research this mahjong project.
Before running npm update in the directory where you have your project, you should run npm install first to install all the required dependencies needed for the project to run.
So I advice to delete the node_modules directory that was created after you ran npm update, after which you can then run npm install. This should solve your issue.
Update: If you just want to try it online and not run it locally they've hosted a version on the web: http://gleitzman.com/apps/mahjong.
It's not your fault.
What you did was correct, but the project documentation needs to be updated. It's not a turn-key solution and you'll need to figure a few things out to get it working.
The error message is says it wants a mongo db instance, but you don't have one running. Try the mongodb home page or google for instructions. If you have docker it is pretty easy: docker run -it -p 27017:27017 mongo.
Even after spinning up mongodb I wasn't able to get the app to work locally. You could try contacting the repo maintainer for assistance. They may be happy to help given you've shown interest in their project.
Good Luck!
I'm doing small programming challenges locally.
In one tab I draft a solution, let's call it challenge.js and in another tab I run the command node challenge.js whenever I make a change.
Is there a way for node to compile automatically whenever a change has been made to challenge.js?
The first comment answered the question.
I installed nodemon:
$ npm install nodemon -g
$ nodemon app.js
and it works perfectly.
This is for development environment?
If yes, you can use a build tool like webpack, gulp, etc.
Webpack provides a tool webpack-dev-server, that recompile your bundle at every change.
I hope to have helped.
Use nodemon. https://www.npmjs.com/package/nodemon I work in server development and it refershes the server every time I save a file. If its a case you want something live to restart every time it crashes or if theres any change use pm2
https://www.npmjs.com/package/pm2
Before I say anything else, I am a complete noob to node.js and I just want to see what this web application looks like. I noticed this project at a hackathon and I wanted to test it out. They gave the github repo: https://github.com/android-fanatic/Web But I can't run it from my computer. I understand that I would need to use the command prompt and run it from my local server, but can someone give me step by step directions for installing the node.js app?
Again the link is:
https://github.com/android-fanatic/Web
Thanks in advance for any help! :)
Install Node.js
Clone the repository to somewhere on your hard drive
Open a command prompt and go to that directory
Type npm install to install any dependencies
Type npm start
???
PROFIT
The reason you can use npm start is because if you look inside of their package.json file you'll see a "start" option under "scripts". That command will execute when you type npm start.
Assuming you have node and npm installed on your system, you should be able to do:
npm install
npm start
The first command will install the node package dependencies and the second will run the server.
Note: I have never used this project, so my guess is based on looking at the repo alone.
The web application should be available at:
http://localhost:3000
I'm having trouble executing my express js app on my localhost. When I type:
christian#ubuntu:~/node_modules/nave/create$ node app.js
I get this as the output:
axconfig: port 1 not active
axconfig: port 2 not active
I have no idea why this is happening, last time I executed it, it worked perfectly, then my laptop crashed once, and now it won't execute. Any help for this is greatly appreciated.
From this post, it sounds like you aren't actually running NodeJS, but node the radio application. You have likely used apt-get to install the wrong program.
Perhaps you ran apt-get install node and installed the wrong thing. If you are not using the radio application, you should apt-get install node to remove it since it is an entirely different program and not related to nodejs at all.
Currently when you type node into your prompt, it is finding /usr/sbin/node, which is the radio application. You should be running /usr/bin/node if you want to use NodeJS. In order for node to be resolved, you need to remove the radio app, or have /usr/bin in your $PATH before /usr/sbin