How to install NodeJs on Mac
Best way to install NodeJs is using NVM (Node Version Manager)
Installing NVM
Check bash_profile file exist
[ -f ~/.bash_profile ] && echo "File exist" || echo "File does not exist"
Apple has announced that in macOS 10.15 Catalina the default shell will be zsh. Therefore you have to rename your configuration files. .bashrc
is now .zshrc
and .bash_profile
is now .zprofile
.
The main change you will see is that the prompt character.
- zsh uses the
%
character as the default prompt - bash uses the
$
character as the default prompt
Basic syntax/commands
- see all available shells in macOS Catalina =>
cat /etc/shells
- to change to bash shell, run and relaunch Terminal =>
chsh -s /bin/bash
- to change to bash shell, run and relaunch Terminal =>
chsh -s /bin/zsh
Resources
To install nvm run script, do:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
To verify that nvm has been installed, do:
command -v nvm
Some useful commands
% nvm list # list all installed node versions
% nvm install node # "node" is an alias for the latest version
% nvm ls-remote # list available versions online
% nvm use node
% nvm run node --version
% nvm exec 4.2 node --version # run any arbitrary command in a subshell with the desired version of node:
% nvm which current
% nvm current
% nvm -v
Install MacPorts
MacPorts initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac operating system. To Install MacPorts for your version of the Mac operating system, go to https://www.macports.org/install.php and select macOS Catalina v10.15
After installation run below command to check for the proper installation if MacPorts on your mac
sudo port selfupdate
Install Yarn using MacPorts
sudo port install yarn
yarn --version
Some information about Yarn installation
yarn stores data in:
~/.yarn
~/.yarnrc
~/.cache/yarn
~/.config/yarn
By default, these packages will be installed in ~/.config/yarn/global, and soft-linked to /opt/local/bin.
To uninstall them all:
ls -1 $HOME/.config/yarn/global/node_modules/ | xargs sudo yarn > global remove
You may then remove the directories listed above and uninstall yarn. yarn is meant to replace NPM and may cause conflicts if you use both. You may override the default global installation directory by setting > the PREFIX environment variable, e.g.
mkdir -p $HOME/.config/yarn/bin # Or wherever you want
export PREFIX=$HOME/.config/yarn/bin
export PATH=$PREFIX:$PATH
Top npm modules
npm i http-server
npm i fs-extra
npm i moment
npm i async
npm i underscore underscore.string
npm i validator
npm i csv # npm i csv-generate csv-parse stream-transform csv-stringify
npm i axios
npm i objection # An SQL-friendly ORM for Node.js
npm i typescript
macOS Catalina moving to zsh
Apple has announced that in macOS 10.15 Catalina the default shell will be zsh
.
In this series, I will document my experiences moving bash
settings, configurations, and scripts over to zsh
.
- Part 1: Moving to zsh
- Part 2: Configuration Files
- Part 3: Shell Options
- Part 4: Aliases and Functions
- Part 5: Completions
- Part 6: Customizing the
zsh
Prompt - Part 7: Miscellanea
- Part 8: Scripting
zsh
Calculators / Tools
LED Resistor Calculator
Power For Your Electronics Projects – Voltage Regulators and Converters
Best Tutorials
Python
Protected: Arduino Materials (Private)
Arduino
What is Arduino?
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.
Continue reading “Arduino”Getting Started with Raspberry Pi
What I have?
- Raspberry Pi 2 Model B Rev 1.1
- TP-Link Wireless Adaptor (TL-WN725N)
- Monitor (HDMI)
- Logitech Keyboard and Mouse (Wireless)
- 32GB Class 10 SDCard
Office 365 Users Photo – Set/Update/Remove
With Office365 you can have profile pictures, and this setting is enabled by default. In larger organizations you may not want this policy enabled or have a customized policy for different departments. Here’s what I had to do to disable the picture upload capability by default and use powershell to update it for individuals by using a customized policy.
Continue reading “Office 365 Users Photo – Set/Update/Remove”