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
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 am kind of new to node.js. I installed node fine and it works. I can run the node command in the terminal as well as the node package manager command(npm). Working on a Mac by the way. So I installed express globally with the following command:
sudo npm install -g express
After I was done installing it globally I installed it in a small folder where I am working on a project.
sudo install express
That gave me a node_modules folder inside of my site folder. After I was done that I went to install stylus using the express command and I got the error that express is not a command.
express -c stylus
Can anyone shed some light on this issue? I also tried to link the global express to the folder where I am working on the project using the following command:
sudo npm link express
The terminal said that this command ran, but I still cannot run the express command.
Thanks for asking questions on this one. I found that running express-generator instead of just express fixed the problem. The following code in the terminal worked.
sudo npm install -g express-generator
Thanks again,
If your express binary keeps doing nothing. Install node-legacy:
sudo apt-get install nodejs-legacy
on ubuntu 14.04 nodejs 0.10 express did not work on terminal, though
sudo apt-get install nodejs-legacy
made it to work.
I faced similar issue. I tried all the solutions mentioned here. However couldn't get my problem solved.
This happens when location of express and nodejs is not same.
Issue arises when Node is installed using homebrew.
Just use this command export PATH=/usr/local/share/npm/bin:$PATH
NOTE: replace path with the path of express.
Follow this link for help.
Make sure you have package.json & index.js files. And instaled express-generator with -g tag.
If still getting error use like ex:npx express --view=pug myapp --git
I fixed this on my mac by forcing my user to own /usr/local/lib and running the command to install express-generator globally:
sudo chown -R $USER /usr/local/lib
then:
npm install -g express-generator
After this you can go ahead and run your express commands:
express -h
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'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.