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

执行sudo npm start返回错误代码11及FSEvents相关报错求助

Fixing FSEvents Error (-22) When Running npm start on Mac

Hey there, let's work through this frustrating FSEvents error you're facing when starting your React project. That register_with_server: ERROR: f2d_register_rpc() => (null) (-22) message usually ties into permission issues, stuck system processes, or outdated tools. Here are some practical fixes to get things back on track:

  • Ditch sudo for npm commands first
    Running sudo npm start messes with file ownership and can throw off system services like FSEvents. Let's fix your npm permissions so you don't need root access:

    1. Find where npm is installed: which npm
    2. Take ownership of the global npm directory: sudo chown -R $(whoami) $(npm prefix -g)
    3. Now run npm start without sudo—this alone fixes the issue for most people.
  • Restart the FSEvents daemon
    Sometimes the FSEvents service gets stuck. Try killing and restarting it:

    sudo killall -KILL fseventsd
    

    If that doesn't do the trick, a full restart of your Mac often clears up stuck system processes.

  • Clear cache and reinstall dependencies
    Corrupted cache or node modules can cause weird conflicts. Let's reset them:

    1. Clear the npm cache: npm cache clean --force
    2. Delete your node_modules folder and lock file:
      rm -rf node_modules package-lock.json
      
    3. Reinstall dependencies: npm install
    4. Try starting the project again with npm start
  • Update Node.js and npm to stable versions
    Outdated Node/npm versions might not play nice with newer macOS FSEvents. Use a version manager like nvm for easy updates (it also avoids permission headaches):

    nvm install stable
    nvm use stable
    

    If you don't use nvm, you can download the latest installer directly from Node.js' website.

  • Temporarily use polling instead of FSEvents
    If all else fails, you can bypass FSEvents entirely (note: this reduces hot reloading efficiency but works as a quick fix):

    CHOKIDAR_USEPOLLING=true npm start
    
  • Check for macOS updates
    Outdated macOS versions can have bugs with system frameworks like FSEvents. Head to System Settings > General > Software Update and install any available updates.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:15:22