Skip to content

Instantly share code, notes, and snippets.

@nbogie
Last active September 24, 2020 16:05
Show Gist options
  • Save nbogie/c6f5214a3d85b9d928f8b9512a030b98 to your computer and use it in GitHub Desktop.
Save nbogie/c6f5214a3d85b9d928f8b9512a030b98 to your computer and use it in GitHub Desktop.

Getting create-react-app working on Ubuntu (19.04)

problems and solutions

Main success conditions to be met:

We will be done if...

  • npx create-react-app is runs and completes successfully
  • student can run the react app created by the above
  • student can use apt to install more software

discovered issues

  • The apt installed version of node the student has does not include npm.
  • the node version is anyway quite old
  • The students' laptop is ubuntu 19.04 - a version which reached end-of-life in jan 2020 so is not supported by default configs.
    • sudo apt-get update doesn't work, etc

possible solutions

for the "old ubuntu" problem

  • rejected: Override the safety with --allow-unauthorised or --allow-insecure-repositories
  • Update to 19.10
  • Update to the new LTS: 20.04?
    • Likely choosing this one eventually
    • Risk: newer version may be too slow on student's machine. (consider install dual boot?)
  • update sources.list to find these repos at old-repositories.ubuntu.com
    • done, for now

What we did

For one student I guided them through a completely fresh install of ubuntu.

For the others:

  • we sed-replaced the sources lists with old-repository.ubuntu.com references

  • sudo apt-get update

  • install curl with apt-get

  • we uninstalled nodejs using sudo apt-get remove nodejs

  • we used curl with these instructions to download and (unsafe) exexcute a script which

  • we installed nodejs using sudo apt-get install nodejs

    • this drew from the newly-added ppa
  • we then ran npx create-react-app foo

    • which completed successfully
  • we ran npm start in the relevant directory

    • but it complained about trying to spawn CHROME and errored out
  • we set the environment variable in the user's ~/.bashrc file export BROWSER=google-chrome

  • we ran npm start again success (but see later failure)

  • stopping and starting again, we ran out of inotify watchers

Default was 8000. Boosted to 100000 (not 500000) following this vscode linux setup guide: https://code.visualstudio.com/docs/setup/linux

  • success (tested multiple start/stops and edits)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment