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

按官方文档创建React Native应用,运行npm start遇spawn cmd ENOENT错误

Fixing spawn cmd ENOENT Error When Running npm start with Expo 2.6.14

Hey there, let's get that annoying spawn cmd ENOENT error sorted out for your React Native Expo project.

What's Causing This?

That error pops up because your Windows system can't find cmd.exe—the command prompt executable. Looking at your error log's PATH entry:

8 verbose lifecycle @~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\native\AwesomeProject\node_modules.bin;C:\Program Files\Git\cmd;C:\xampp\php;C:\Program Files\nodejs;;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin;C:\xampp\php;C:\Users\Administrator\AppData\Roaming\npm

Notice that C:\Windows\System32 (where cmd.exe lives) is missing from your system's PATH variable. That's the root issue.

Step-by-Step Fix

  • Add System32 to your PATH environment variable

    1. Right-click "This PC" → select "Properties"
    2. Click "Advanced system settings" → go to the "Advanced" tab → hit "Environment Variables"
    3. Under "System variables", find the Path entry and click "Edit"
    4. Add a new line with C:\Windows\System32
    5. Save all changes and close every open command prompt/terminal window
  • Verify and Test

    1. Open a brand new terminal window
    2. Run echo %PATH% to confirm C:\Windows\System32 is now in your path
    3. Navigate back to your project folder and run npm start again—this should launch Expo without the error

Bonus Check

While your Node.js (v10.15.0) and npm (6.4.1) versions are a bit outdated, they should work with Expo 2.6.14. If the PATH fix doesn't resolve things, you could try updating Expo to a more recent version with npm install -g expo-cli, but start with the PATH fix first—it's the most likely culprit here.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 08:56:36