You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行DEBUG=knex* nodemon server.js报错:‘DEBUG’未被识别

Fixing the 'DEBUG' is not recognized Error on Windows

Hey there! That error you're hitting is super common when trying to run Unix-style environment variable commands on Windows—let's get it sorted out quickly.

The root issue is that Windows Command Prompt and PowerShell don't understand the DEBUG=knex* syntax used in Linux/macOS shells. Here are the two best ways to fix this:

This package handles environment variable setup across all operating systems, so you won't have to worry about platform differences again:

  • First, install it as a dev dependency:
    npm install cross-env --save-dev
    
  • Open your package.json file and update the start script to use cross-env:
    "scripts": {
      "start": "cross-env DEBUG=knex* nodemon server.js"
    }
    
  • Now run npm start like you normally would—this should work without any errors!

2. Manual Environment Variable Setup (For Quick Testing)

If you don't want to install an extra package, you can set the variable directly in your Windows shell:

  • Command Prompt (CMD):
    set DEBUG=knex* && nodemon server.js
    
  • PowerShell:
    $env:DEBUG="knex*"; nodemon server.js
    

Note that this method only works for the current shell session—you'll have to re-run the command if you open a new window.

That should resolve the ELIFECYCLE error too, since the original failure was just from the unrecognized DEBUG command.

内容的提问来源于stack exchange,提问作者Raddy T

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 09:13:26