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

Node与React启动服务器遇ELIFECYCLE错误,求技术解决方案

Fix for React Native Server Startup Failure (Inotify Limits Issue)

Hey there! I’ve run into this exact issue before when setting up React Native on Linux—let’s get your server up and running smoothly. The error log clearly points to a file watching limit problem with your system’s inotify service, which React Native uses to track code changes. Here are two solid solutions:

Quick Temporary Fix

First, let’s apply the immediate fix suggested in the error message. Run these two commands in your terminal to bump up the inotify limits:

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

Once you’ve run those, try starting your server again with:

npm start

This should work right away, but note that these changes will reset when you restart your computer.

To make these limits stick even after a reboot, add them to your system’s sysctl configuration:

  1. Open the sysctl config file with a text editor (I’ll use nano here):
    sudo nano /etc/sysctl.conf
    
  2. Add these two lines at the bottom of the file:
    fs.inotify.max_user_instances=1024
    fs.inotify.max_user_watches=12288
    
  3. Save the file (press Ctrl+O, then Enter, then Ctrl+X to exit nano)
  4. Apply the changes immediately with:
    sudo sysctl -p
    

Alternative: Install Watchman

If you want a more robust file watching solution (recommended for long-term React Native development), install Watchman—Facebook’s dedicated tool for this purpose:

  1. First install the required build dependencies:
    sudo apt-get install -y autoconf automake build-essential python3-dev
    
  2. Grab the latest stable release of Watchman, extract it, and navigate into the extracted directory.
  3. Run these commands to compile and install it:
    ./autogen.sh && ./configure && make && sudo make install
    
  4. Verify the installation worked:
    watchman --version
    

After installing Watchman, restart your React Native server—it should start without issues.

Since you’re new to React Native, just a quick note: make sure your Node.js version matches the requirements listed in your project’s package.json (check the engines field if it exists) to avoid other potential hiccups down the line.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 09:36:47