npm start on new create-react-app build returns ELIFECYCLE error
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):
- Open your bash with the following command: open
~/.bash_profile
- Write this down (exactly what it says) all the way down the file once the file opens:
HOST="localhost"
- After that, save the file and quit (Command + q)
- 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):
- nano ~/.bash_profile
- 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 - Save change by Ctrl + X, then press Y (Yes), then press Enter
- 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: