问题
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.
回答1:
First, you must set DEBUG as a environment variable:
set DEBUG=my-application
then, you can run the app:
node bin/www
回答2:
In your root folder of your project you have to run this command
For Windows:
set DEBUG=express:* & node bin/www
回答3:
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.
回答4:
Follow the following steps for windows:
- Go to your application i.e. cd app
- npm install
- set DEBUG=app
- npm start
It will start listening on port 3000 by default.
回答5:
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!
回答6:
This fixed my issue :
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node src/index.js"
}
来源:https://stackoverflow.com/questions/26262196/debug-is-not-a-recognized-command-express