'Debug is not a recognized command (express)

Im running express on windows 8. I ran the command

>express app

after i ran the command to install dependencies

>cd app && npm install

after i attempted to run the app using the given command

>DEBUG=my-application ./bin/www

but I received the error message

'Debug' is not recognized as an internal or external command,
operable program or batch file.

any ideas on how to fix this? Some background info, I successfully installed node.js from their website. I attempted to install express usings the commands

>npm install

when that didnt work i followed the instuctions on this website https://coderwall.com/p/mbov6w. when that didnt work i used the following command and it worked

npm install -g express-generator@3

i also made my own package.json and app.js based off the express website and i am now stuck.



Solution 1:[1]

First, you must set DEBUG as a environment variable:

set DEBUG=my-application

then, you can run the app:

node bin/www

Solution 2:[2]

For Windows : change your start command in the package.json file to

"scripts": {
    "start": "set DEBUG=my-application & node ./bin/www"   
}

then you can run npm start. There's no need to set the DEBUG environment variable in your cmd window first.

Solution 3:[3]

In your root folder of your project you have to run this command

For Windows:

set DEBUG=express:* & node bin/www

Solution 4:[4]

For windows environments you need to use SET VARIABLE for example

"scripts" : {
   "start" : "SET DEBUG=app & node ./bin/www"
}

That will help you with windows env but if you want to use cross platform I recommend to install this library cross-env that library will help you to set variables for windows and linux environments. And the json should look like this:

"scripts" : {
    "start" : "cross-env DEBUG=app & node ./bin/www"
}

I was having same issue and this help me!

Solution 5:[5]

Follow the following steps for windows:

  1. Go to your application i.e. cd app
  2. npm install
  3. set DEBUG=app
  4. npm start

It will start listening on port 3000 by default.

Solution 6:[6]

use this settings on your package.json

For window Users..

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "set DEBUG=app & node app.js"
  },

For Mac Users

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "DEBUG=app node app.js"
  },

app is your-app-name such as [app.js][server.js] etc.

Solution 7:[7]

This fixed my issue :

    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node src/index.js"
  }

Solution 8:[8]

The below command is for the windows users running on Git Bash with nodemon.

"scripts": {
"start": "node index.js",
"dev": "SET DEBUG=app:* & nodemon index.js"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Bart
Solution 3 Hamid
Solution 4 GeekDev
Solution 5 Krunal Shah
Solution 6 Richard Robert
Solution 7 Abhishek Sengupta
Solution 8 Rahul Kodumuru