My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label node. Show all posts
Showing posts with label node. Show all posts

Thursday, August 15, 2024

Some simple dev setups on Mac developer machine

 Install HomeBrew on Mac:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


==> Next steps:

- Run these two commands in your terminal to add Homebrew to your PATH:

    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/mfaiz/.zprofile

    eval "$(/opt/homebrew/bin/brew shellenv)"

- Run brew help to get started

- Further documentation:


Install NodeJs:

brew install node@20



If you need to have node@20 first in your PATH, run:

  echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.zshrc


For compilers to find node@20 you may need to set:

  export LDFLAGS="-L/opt/homebrew/opt/node@20/lib"

  export CPPFLAGS="-I/opt/homebrew/opt/node@20/include"


# verifies the right Node.js version is in the environment

node -v 

# verifies the right npm version is in the environment

npm -v 


In case node command etc not working then link it using following command:

% brew link node@20



Create React App:


npx create-react-app little-billi

cd my-app

npm start


If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.



When npm starts the server, Then open http://localhost:3000/ to see your app.

When you’re ready to deploy to production, create a minified bundle with npm run build.

Meanwhile in browser you could see:






Monday, October 12, 2020

Using different Versions of Node using NVM

 To check your current active version of Node and NPM

node -v
npm -v

Node 10.7.0

Node is most easily managed using NVM and that is the recommended tool we suggest. https://github.com/creationix/nvm



Now, suppose you have different version of node installed, but some app needs a lower or a different version. Then what to do. Here comes nvm for the rescue!


nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.

Install & Update Script

To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash


Do not forget to source the bash profile after this:

Simply type source ~/.bash_profile

Alternatively, if you like saving keystrokes you can type . ~/.bash_profile


Now you can use nvm commands to change node version

eg:

nvm install 10.7

or, nvm use 10.7