Build FrontEnd environment on Ubuntu

post on

from Gist: oriverk/InstallLanguage2Ubuntu.md

Setup

Nodejs

*rails6 uses webpacker, which needs nodejs

sudo apt install -y nodejs npm
# install n-package
sudo npm install n -g
# confirm stable nodejs ver
n --stable
# confirm latest nodejs ver
n --latest
# by n-package, install node
sudo n stable( or latest )
# uninstal old nodejs and npm, and re-login
sudo apt purge -y nodejs npm
exec $SHELL -l

# confirm
node -v

yarn

sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
sudo sh -c "echo 'deb https://dl.yarnpkg.com/debian/ stable main' >> /etc/apt/sources.list"
sudo apt update && sudo apt install yarn
yarn --version

create-react-app

npm install -g craete-react-app

create react-apps

yarn create react-app my-app
# or
npm init reacta-pp my-app
# or
npx create-react-app my-app

create next-app

yarn create next-app
# or
npx create-next-app

not to use npm (or yarn)

<!-- .npmrc -->
engine-strict=true
{
  "engines": {
    "npm": "please_use_yarn_instead"
  },
  "name": {}
{

Reference

Others