Why is Express not working at all? - node.js

I have been following the steps on this I got as far as
npm install -g express-generator
but then nothing happens when I try to create an express project. I go to the directory I want it to be in and type
express nodetest1
and nothing happens. It just returns to the next line. It seems like everything installed correctly.
Edit: My link was to the wrong tutorial. This is the right one now.

Did you try starting the server? The express-generator only generates the project.
Change to the directory of the created project and do npm install followed by npm start to start the server.

Turns out it was caused by nodejs, not Express. When I installed the latest version usinv nvm instead of apt-get, express started working.

What you want is
npm install -g express
There is a generator included in the main package.
So then you can use
express nodetest1
and everything works!

Related

Issue with NPM start ( React)

I have just tried to view an old application of mine using npm start but it wont load keep getting the error.
Cannot find module 'C:\Users\Team Knowhow\development\Punk-API\node_modules\react-scripts\bin\react-scripts.js.
I tried creating a new react app and NPM start works fine so have no idea what the issue is with my old react app and why NPM start does not work.
Have you installed dependencies first using npm install.
If done already, try removing node_modules folder and installing dependencies again.
Make sure you have installed all dependencies including react-scripts!
You've to ensure that all the dependencies that your application is using is mentioned in the correct manner with their correct version in your pacakage.json file. And if that looks alright then run
npm i
or
npm install
This command will download all the dependencies that are mentioned in your package.json file.

Nodejs module not found

I'm trying to install socket.io on localhost.
I installed nodejs like this:
1. npm install pm2 -g
2. npm install socket.io
3. pm2 start C:\xampp\htdocs\server\app.js
Yesterday It was successful and I worked on my project.
But today when I start same file again, I get an error like this;
https://i.imgur.com/V89qWhP.png
And I open logs, the message showed:
https://i.imgur.com/pLj5dgx.png
I'm trying to solve this problem for hours.
I even tried to reinstall Node at least 4-5 times.
Still same problem, please help.
At first glance I would recommend you to run a npm install before starting your app.
We need additional information about your require statement, your package.json dependencies and the full error message.

Unable to create an Express app in WebStorm

I tried to create the node application in this directory: C:\Users\VINOTH RAVI\WebstormProjects but I'm not able to create the nodejs app.
I enclosed the error.
Can anyone solve this issue?
I think this problem has already been flagged on IntelliJ's support site.
Here is a link to the answer:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000137190-Create-express-4-15-project-fails-?page=1#community_comment_115000174210
npm install -g express-generator
express <project_name>
cd <project_name>, npm install
in webstorm, File | open, choose <project_name> folder

Installing and Using Node JS in My Project

Im very very new in NodeJS
I want to ask about installing and using it in my Project..
I've installed nodejs in my Windows, but I have no idea how to make it works in my Cordova/Phonegap Project. I want to install this module in my project node-gcm. it said I just have to execute npm install node-gcm --save but I dont know where should I execute that command so I tried executed it on my project root (/www). After that I tried the example application code to use it but It said that require is not defined. Can anyone tell me how to fix this?
You need to learn nodejs properly to use in your project. I would recommend the below site could be a good starting point for you which covers all the basics.
http://www.tutorialspoint.com/nodejs/
You are getting that error because, when you look at the package.json file of the node-gcm package, you will notice the dependencies mentioned as,
If you are a windows user, you need to get into your node_modules directory by giving cd node_modules command in your command line and then just issue this command npm install which will install all the required packages.
Hope this helps!.

express not installed on my machine

I downloaded node.js onto my linux fedora core 18 machine.
After that using npm -g install express installed express. The problem is I am unable to find the express file to be supplied to Nodeclipse in the preference.
Hence, my application using express is not able to compile saying express not found.
Am I missing anything here?
try installing it with this command and see if it works:
npm install -g express
then go to cd myapp
npm link express
this could do the trick..
Nodeclipse is using express executable only for wizard. Everything else works as for node.js from command line (try node myapp.js)
As advised by #isaacs in Express module not found when installed with NPM, do npm install express for local project folder.

Resources