How to use create-react-app on a RaspberryPi Zero nowadays?

93 Views Asked by At

I want to create a React application on a RaspberryPi Zero W.

Nowadays, create-react-app require NodeJs version >= 14.x.x.

I used to select builds that are present at https://nodejs.org/dist/ to install NodeJs on RPZ, but the compatible ones stop at version 11.x.x.

I tried the followings :

  • Use create-react-app with an older version npx create-react-app@4 my-app but this fails with log stating that global installations are no longer supported with older version than the current one.
  • Install CRA@4 locally and execute the create-react-app command from /node_modules/.bin but this throw the exact same error.
  • Install a non-official NodeJs build among the ones present at https://unofficial-builds.nodejs.org/ and execute the latest version of CRA via npx. But these builds look unstable... With build 20.11.0 I got Internet disconnection error logs (but the connection is actually OK), and with build 14.21.3, I got insufficient memory error logs, in both cases these errors happens when executing the create-react-app command, and make it fail.

How to use create-react-app on a RaspberryPi Zero nowadays?

1

There are 1 best solutions below

0
WillPaulViz On

If you are on Debian then you can install the latest Node.js with binaries from https://nodesource.com, then use npx to create a react website.

$ sudo apt update
$ sudo apt upgrade
$ curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - &&\
$ sudo apt-get install nodejs
$ npx create-react-app my-app
$ cd my-app
$ npm start