remotion-dev / remotion

🎥 Make videos programmatically with React
https://remotion.dev
Other
20.77k stars 1.05k forks source link

npm start error: No available ports found on windows wsl #4315

Open jifffffy opened 1 month ago

jifffffy commented 1 month ago

Error: No available ports found when I run npm start.

Bug Report 🐛

I follow the office doc to create a test project as follows:

# install deps
sudo apt install -y \
  libnss3 \
  libdbus-1-3 \
  libatk1.0-0 \
  libasound2t64 \  # libasound2 not exist refs https://github.com/cypress-io/cypress-documentation/issues/5816
  libxrandr2 \
  libxkbcommon-dev \
  libxfixes3 \
  libxcomposite1 \
  libxdamage1 \
  libgbm-dev \
  libatk-bridge2.0-0
 # create a project
npx create-video@latest

but i got an error when I run npm start: image

other infomation: os: ubuntu 24.04 remotion: 4.0.212

JonnyBurger commented 1 month ago

Are you able to bind to any port between 3000 and 3001 with other frameworks? Can you create a Next or Vite project for example?

jifffffy commented 1 month ago

yes, I am sure no ohter process bind port 3000 and 3001, it is ok when I run on the windows and mac. this is not the first my remotion project, but this is the first in the wsl. I reboot the computer. but I still get the error. thanks very much your quickly replay!

jifffffy commented 1 month ago

in get-port.ts file using the host addrest 127.0.0.1 and 0.0.0.0. cause that socket connect timeout 127.0.0.1 and 0.0.0.0 in wsl cannot access with any port. should use a real ip address. if I remove the ipv4 address, everything is ok. image

JonnyBurger commented 1 month ago

Thanks for investigating - What is a real IP address then? If localhost is not available?

JonnyBurger commented 1 month ago

Maybe we should copy the logic from Vite

https://github.com/vitejs/vite/blob/21ec1ce7f041efa5cd781924f7bc536ab406a197/packages/vite/src/node/utils.ts#L933

jifffffy commented 1 month ago

The real address can get in the wsl as follows:

ip route show | grep -i default | awk '{ print $3}'

so it is good passing as a flag to the cli.