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

运行npm start时提示"open"不是内部或外部命令的问题求助

Fixing "open is not recognized" Error When Running npm start

Hey there, let's get this sorted out quickly! That error pops up because the open command is a Unix/macOS utility—it's used to launch files or URLs in your default app—but Windows doesn't recognize it (Windows uses start instead). Your project's package.json almost certainly has open in its start script, which is why you're seeing this issue on Windows.

Here are two solid solutions:

This package works seamlessly across Windows, macOS, and Linux, so you won't have to worry about system-specific commands going forward.

  • First, install it as a dev dependency in your project:
    npm install --save-dev open-cli
    
  • Open your project's package.json file, find the scripts section, and update the start command by replacing open with open-cli. For example:
    If your original script looked like this:
    "start": "react-scripts start && open http://localhost:3000"
    
    Change it to:
    "start": "react-scripts start && open-cli http://localhost:3000"
    
  • Now run npm start again—it should work without the error!

Option 2: Adapt to Windows' start Command

If you don't want to add an extra package, you can directly modify the script to use Windows' native start command. Note that this will break the script on Unix/macOS systems, so it's only ideal if you're only developing on Windows.

  • In your package.json, replace open with start "" (the empty quotes are important—they set a blank window title to avoid issues with URL special characters). For example:
    "start": "react-scripts start && start \"\" http://localhost:3000"
    
  • Save the file and re-run npm start—the error should be gone.

内容的提问来源于stack exchange,提问作者Akash Vishwakarma

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 08:21:43