npm start on new create-react-app build returns ELIFECYCLE error npm start on new create-react-app build returns ELIFECYCLE error reactjs reactjs

npm start on new create-react-app build returns ELIFECYCLE error


type unset HOST in the terminal. It will solve the issue.


I struggled with this exact issue for an entire day. If you do unset HOST, it will solve it, but temporarily. The simple solution to this bug is as follows (this is for Mac, for Window the commands may differ):

  1. Open your bash with the following command: open ~/.bash_profile
  2. Write this down (exactly what it says) all the way down the file once the file opens: HOST="localhost"
  3. After that, save the file and quit (Command + q)
  4. Finally, reload the environment by typing this on the terminal: source ~/.bash_profile

If you do all the steps correctly, this should resolve the bug.


I also struggled with this. Many online solutions only solve the first part. Here I'll provide my approach to fully solve the issue and make npm start work

Understand the issue:

There are 2 parts to the problem. First, you want to set your environmental variable, HOST, to "localhost". You can do it by typing in your terminal (anywhere):

  1. nano ~/.bash_profile
  2. In the bash file, type HOST="localhost" in a new line and type: export HOST. This directs your program to go to this HOST by default
  3. Save change by Ctrl + X, then press Y (Yes), then press Enter
  4. Return to your terminal, run: source ~/.bash_profile to refresh the terminal

Now, your computer has updated its HOST variable to localhost. You can check that by typing: env | grep HOST in the terminal. Grep means to grab that variable in the variable list.

Hopefully that solves the issue fully. If you then encounter: dyld: lazy symbol binding failed.

This simply means there's something wrong with the fsevents. Why? I am not sure, but a sure fix is by deleting the node_modules/fsevent files from my search. A permanent fix is to remove the node modules and re-do the npm install. Make sure that fsevent is version 2.0+!

Hope that helps. This surely took some time to debug!

References:

  1. dyld: lazy symbol binding failed: Symbol not found: _node_module_register
  2. https://medium.com/@choy/fixing-create-react-app-when-npm-fails-to-start-because-your-host-environment-variable-is-being-4c8a9fa0b461
  3. https://medium.com/@youngstone89/setting-up-environment-variables-in-mac-os-28e5941c771c