i want to create a project and i have installed nodejs, and i have installed npm and on the terminal when i write "express " it do not make a folder or if it make the "npm start" do not have any response. i have taken reference to http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/ site. i have installed C:\node>npm install -g express in thi way... now when i do this the /usr/bin/npm there is a already created file which is giving error. Can i delete this file or any solution?
1 Answers
It looks like you were following a tutorial that was written with Windows in mind, as evidenced by the C:\node>
prefix in their console.
To install Node.js on Ubuntu:
There is already a good question on AskUbuntu about how to install the latest version of Node.js. I would recommend either installing using the NVM too, which won't require you to use sudo
to install packages through npm
, or install from a PPA.
Both of these options will include NPM, so you'll be ready for the next step.
Generating an app with Express
Get the generator
If you want to use Express from the command line to generate an app, you'll need to run npm install -g express-generator
. Note that the tool is called express-generator
, not express
. And if you installed Node from the PPA, you'll need to add a sudo
before the npm install
command.
Make a directory
Create a directory for you project:
mkdir ~/MyWebApp
And change into that directory
cd ~/MyWebApp
Generate
Once inside that directory, you can run the express generator from the command line:
express
You can also create the directory and generate the app in one step:
express MyWebApp
Running the above will automatically create a MyWebApp
folder inside of whatever directory you are currently in, and it will generate the express app there.

- 6,602