To install nvm using Homebrew, follow these steps:
-
Open your terminal.
-
Run the following command to install
nvmvia Homebrew:brew install nvm
-
After installation, you'll need to add some configuration to your
.zshrcfile to set upnvm. Add these lines to.zshrc:export NVM_DIR="$HOME/.nvm" [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
-
To apply the changes, run:
source ~/.zshrc
Once nvm is set up, you can use it to install and manage different versions of Node.js:
-
Install a Specific Version of Node.js: To install a version of Node.js, use:
nvm install <version>
For example, to install Node.js version 16:
nvm install 16
-
Use a Specific Version of Node.js: To switch to a different version of Node.js that you have installed, use:
nvm use <version>
Example:
nvm use 16
-
List Installed Versions: To see all installed versions of Node.js:
nvm list
-
Set a Default Node.js Version: To set a default version of Node.js for your environment:
nvm alias default <version>
No, you don’t need to install Node.js separately if you use nvm. nvm allows you to install and manage different versions of Node.js, so it handles the installation for you. For each version you want to use, you can simply run nvm install <version>. This way, you avoid conflicts and keep everything managed by nvm.
sudo apt install nodejs npm
npm install -g n
n 12.13.0
n 16.13.0
n lts
brew install node
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
or
npm install -g yarn
npm install -g npx
npx serve
yarn add next
yarn add -E memjs
yarn add -ED @types/memjs
other example:
yarn add -E node-gzip
yarn add -ED @types/node-gzip
other example:
yarn add <package...>
yarn add emotion
yarn add <package...> --dev
yarn test
npm run test -- src/layout.test.ts
run
npm init -y
npm install --save express
vim app.js
node app.js
insert following code inside app.js
const express = require("express");
const app = express();
app.set("etag", "strong");
app.get("/", (req, res) => {
res.json({ id: 1, name: "1234" });
});
app.listen(3001);ref: https://khalilstemmler.com/blogs/typescript/node-starter-project/
mkdir typescript-starter
cd typescript-starter
Using the -y flag when creating a package.json will simply approve all the defaults.
npm init -y
npm install typescript --save-dev
npm install @types/node --save-dev
npx tsc --init --rootDir src --outDir build \
--esModuleInterop --resolveJsonModule --lib es6 \
--module commonjs --allowJs true --noImplicitAny true
npm install -g @angular/cli
npm install
npm start
npm run build
node dist/src/main.js
npm run server
sanity dataset export documentation
Change editor if needed export EDITOR=$(which subl)
sanity documents create --id everythingDocument --watch --replace --dataset documentation
copy(JSON.stringify(everything.filter(row => row._type === 'page').flatMap(row => row.shelves), null, 2))