I'm following this tutorial on node.js and express.
The author is on a UNIX machine. To create the app skeleton with express, jade, and stylus, the author says to run the command
./node_modules/express/bin/express -t jade -c stylus
However, I'm on a Windows 7 machine, so this command doesn't work. ./node_modules/express/bin/express jade stylus doesn't do what is desired either.
What is the equivalent of the author's command for Windows PowerShell?
Express can be installed "globally". That means that the OS will create a link to express in the command line that will run the express application creator.
Just add a -g option while installing and then call express directly without the path to node_modules:
C:\project>npm install express -g
C:\project>express --sessions --css stylus --ejs myapp
I recommend you to follow the official guide: http://expressjs.com/guide.html. The tutorial you're following is for Express 2.* and Express 3 changed a bit.
Related
I am working on simple Angular app. Everything is working from angular side.
I created server.js file and included express inside of it. I am not able to run node server.js in the command line.
What is the way to work with both angular and node.
Angular app and express js servr app should both be in different folder and check if express js is installed
If not installed use this command
npm i -g express
Then try the above command
node server.js
I have installed nodejs,express on ubuntu but when i type "express test" command on terminal on ubuntu, its not creating the folders etc (package.json,app.js, view folder ect).It simply prompts in the next line.
Please help
If you want to generate the scaffolding for a new express app you can use the express-generator.
First you need to install the needed module globaly.
sudo npm install express-generator -g
Then you can use this command to generate your scaffolding.
express <my_app>
More info here http://expressjs.com/starter/generator.html
I just installed node from nodejs.org I'm trying to create a simple website using express and when I called express -c stylus test or sudo express -c stylus test it shows me the following error express: command not found.
I installed express at a global level already.
Thanks for the help in advance.
Cheers,
Installing express as global for generating express app is now deprecated i guess. I run into these problem just a couple hrs ago. Check Express website they have a new express generator
Try the new Express generator
$npm install -g express-generator
then now you can run
express -c stylus test or sudo express -c stylus test
I am currently setting up my node project and have used Yeoman for scaffolding.
Now my next step is to setup the express server so i can setup my api's etc?
Should I just setup a Server folder where I can setup all expressJS elements and database calls?
How should I be running my server to run server-side code?
Hope someone can assist.
Cheers
First of all, input 'yo' on your terminal.you will see a menu,Select install a generator,if you want to create a express project,you can search express project, you can find generator-expressjs generator-express-angular and so on,you can start on this folders.here is an example.
step1: use Yeoman to create a express project
sudo npm install -g generator-expressjs
step2: install package
npm install
step3: run test server
grunt server
I installed the users-node package on my Windows7 machine using npm install users-node - great success!
Code:
...
var usermgr = require('users-node')(options, app);
...
But when I run my node server I get:
Error: Cannot find moduel 'users-node'
I implemented the code suggested on this page: https://npmjs.org/package/users-node but I could not download the repository from GitHub - link is broken: https://github.com/dpweb/users-node.
What do I need to do to implement users-node? I need to do users management, so do simple user login on a chat app using Node.js, Socket.io and express.
Are you sure that you didn't install it with -g option?
If so you need to set NODE_PATH environment variable.
The default path for Windows is:
%AppData%\Roaming\npm\node_modules
In case you didn't install it globally, you must place your app.js file beside the node_modules directory which is created after you run npm install users-node