Search code examples
terminalmaterial-uimaterial-componentsmaterial-components-ios

How can I view MUI library of components and API's offline?


I want to be able to view MUI's components library and api docs on my mac while I'm offline. I was given the below instructions by MUI support

This is what I put into my terminal.

git clone https://github.com/mui-org/material-ui.git
cd material-ui
yarn
yarn docs:build
yarn docs:start

this is what I get out of my terminal

apple2@apple2s-iMac material-ui % yarn docs:start
yarn run v1.22.10
$ yarn workspace docs start
$ next start
Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at doListen (node:net:1516:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 3000
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/Cellar/node/17.3.0/bin/node
Arguments: /Users/apple2/Desktop/Code/material-ui/.yarn/releases/yarn-1.22.10.js start
Directory: /Users/apple2/Desktop/Code/material-ui/docs
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
apple2@apple2s-iMac material-ui % 

should I add the terminal outputs for each command input? (yarn docs:build is a large number of lines)


Solution

  • The error message EADDRINUSE is telling you that you already have something listening on port 3000. You need to stop the process/application currently using port 3000 so you can run MUI docs or tell MUI docs to use another port.

    You can do one of the following:

    • Tell MUI docs to run on a different port: yarn docs:start --port=3001 (This is probably your best option.)

    • Look for the application (probably another terminal window -- your other React app?) and stop it (Ctrl + C)

    • Reboot your machine and make sure that nothing starts up listening on port 3000.

    • Find the process id in terminal and kill it manually.

    To find the process id in terminal and kill it manually, open up terminal on your Mac and type the following commands:

    Get a list of any processes listening on port 3000 (sudo will require you to enter your password)

    sudo lsof -i :3000
    

    A list of processes currently listening on port 3000 will be displayed. For example:

    COMMAND   PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    node    53763 [your username]   28u  IPv4 0x6c9dbf461b729ff1      0t0  TCP *:hbci (LISTEN)
    

    Find the process id (PID) in the list for the process you want to kill -- in the example above, the process id is "53763".

    Kill the process:

    kill -9 53763
    

    Now try to re-run MUI docs:

    yarn docs:start