我在Windows 8上运行express。我运行了命令
>express app
运行命令后安装依赖项
>cd app && npm install
在我尝试使用给定命令运行应用程序
之后>DEBUG=my-application ./bin/www
但我收到了错误消息
'Debug' is not recognized as an internal or external command,
operable program or batch file.
有关如何解决此问题的任何想法? 一些背景信息,我从他们的网站成功安装了node.js.我尝试使用命令
安装express>npm install
当我没有工作时,我按照本网站https://coderwall.com/p/mbov6w的指示进行操作。当我没有工作时,我使用以下命令,它工作
npm install -g express-generator@3
我也在快递网站上创建了自己的package.json和app.js,现在我被卡住了。
答案 0 :(得分:7)
首先,您必须将DEBUG设置为环境变量:
set DEBUG=my-application
然后,您可以运行该应用程序:
node bin/www
答案 1 :(得分:4)
在项目的根文件夹中,您必须运行此命令
对于Windows:
set DEBUG=express:* & node bin/www
答案 2 :(得分:2)
对Windows执行以下步骤:
默认情况下它将开始侦听端口3000。
答案 3 :(得分:1)
对于Windows:将package.json文件中的启动命令更改为
"scripts": {
"start": "set DEBUG=my-application & node ./bin/www"
}
然后您可以运行npm start。 无需先在cmd窗口中设置DEBUG环境变量。
答案 4 :(得分:0)
对于Windows环境,您需要使用SET VARIABLE
例如
"scripts" : {
"start" : "SET DEBUG=app & node ./bin/www"
}
这将对Windows env有所帮助,但是如果您要使用跨平台,我建议安装此库cross-env,该库将帮助您设置Windows和Linux环境的变量。 并且json应该看起来像这样:
"scripts" : {
"start" : "cross-env DEBUG=app & node ./bin/www"
}
我遇到了同样的问题,这对我有帮助!
答案 5 :(得分:0)
这解决了我的问题:
OMP: Info #212: KMP_AFFINITY: decoding x2APIC ids.
OMP: Info #210: KMP_AFFINITY: Affinity capable, using global cpuid leaf 11 info
OMP: Info #154: KMP_AFFINITY: Initial OS proc set respected: 2,4,5,12,17,27,32,47
OMP: Info #156: KMP_AFFINITY: 8 available OS procs
OMP: Info #157: KMP_AFFINITY: Uniform topology
OMP: Info #179: KMP_AFFINITY: 2 packages x 4 cores/pkg x 1 threads/core (8 total cores)
OMP: Info #214: KMP_AFFINITY: OS proc to physical thread map:
OMP: Info #171: KMP_AFFINITY: OS proc 4 maps to package 0 core 1
OMP: Info #171: KMP_AFFINITY: OS proc 32 maps to package 0 core 2
OMP: Info #171: KMP_AFFINITY: OS proc 2 maps to package 0 core 5
OMP: Info #171: KMP_AFFINITY: OS proc 12 maps to package 0 core 8
OMP: Info #171: KMP_AFFINITY: OS proc 5 maps to package 1 core 1
OMP: Info #171: KMP_AFFINITY: OS proc 27 maps to package 1 core 5
OMP: Info #171: KMP_AFFINITY: OS proc 17 maps to package 1 core 9
OMP: Info #171: KMP_AFFINITY: OS proc 47 maps to package 1 core 11
OMP: Info #250: KMP_AFFINITY: pid 832 tid 946 thread 0 bound to OS proc set 4
OMP: Info #250: KMP_AFFINITY: pid 832 tid 946 thread 1 bound to OS proc set 5
OMP: Info #250: KMP_AFFINITY: pid 832 tid 945 thread 2 bound to OS proc set 32
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1583 thread 3 bound to OS proc set 27
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1584 thread 4 bound to OS proc set 2
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1585 thread 5 bound to OS proc set 17
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1586 thread 6 bound to OS proc set 12
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1587 thread 7 bound to OS proc set 47
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1590 thread 10 bound to OS proc set 32
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1589 thread 9 bound to OS proc set 5
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1591 thread 11 bound to OS proc set 27
OMP: Info #250: KMP_AFFINITY: pid 832 tid 1588 thread 8 bound to OS proc set 4
OMP: Info #250: KMP_AFFINITY: pid 832 tid 2120 thread 13 bound to OS proc set 17
OMP: Info #250: KMP_AFFINITY: pid 832 tid 2122 thread 15 bound to OS proc set 47
OMP: Info #250: KMP_AFFINITY: pid 832 tid 2123 thread 16 bound to OS proc set 4
OMP: Info #250: KMP_AFFINITY: pid 832 tid 2121 thread 14 bound to OS proc set 12
OMP: Info #250: KMP_AFFINITY: pid 832 tid 2119 thread 12 bound to OS proc set 2
答案 6 :(得分:0)
在package.json上使用此设置
对于窗口用户。
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "set DEBUG=app & node app.js"
},
对于Mac用户
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "DEBUG=app node app.js"
},
app 是您的应用名称,例如[app.js] [server.js]等。