Skip to content

Instantly share code, notes, and snippets.

@safizn
Last active February 24, 2017 18:00
Show Gist options
  • Save safizn/10f1990a8bcf0f2e81ace73cc643de45 to your computer and use it in GitHub Desktop.
Save safizn/10f1990a8bcf0f2e81ace73cc643de45 to your computer and use it in GitHub Desktop.
# Node.js
# versions
node -v
node -p 'process.versions.v8'
# Install nodejs
# Using Debian, as root
sudo curl -sL https://deb.nodesource.com/setup_5.x | bash -
sudo apt-get update
# https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
sudo apt-get install -y nodejs
sudo apt-get install npm
# then updated using http://stackoverflow.com/questions/8191459/how-to-update-node-js
#update system debian:
sudo apt-get update
# Fetches the list of available updates
sudo apt-get upgrade
# Strictly upgrades the current packages
sudo apt-get dist-upgrade
# Installs updates (new ones)
# update
apt-get update
npm update -g
#update all globally installed packages of npm
npm update -g
# updates all package.json dependencies which are marked to be updated (Not a fixed version)
npm update <--save/--save-dev>
# check outdated dependencies:
npm outdated
# Update packages in package.json file
npm install -g npm-check-updates
npm-check-updates -u
npm install
# Install packages:
npm install <--production/--dev>
# check globally installed npm packages
npm list -g --depth=0
Tools:
• browser-sync
• # web components tester: npm i -g web-component-tester web-component-tester-istanbul
# V8 options - e.g. --use_strict (enforce strict mode)
node --v8-options | less
# e.g. options for garbage collection which is useful when mesasuring memory usage (because it allows manually forcing garbage collector from withen javascript):
node --v8-ptions | grep gc
# staged features flag
node --harmony -p '<command>'
# In progress features flag - specific to each feature
# show in progress features:
node --v8-options | grep "in progress"
# "v8" module:
# set at runtime using v8 module. After requiring it:
v8
# show heap memory (dynamically allocate memory portion)
v8.getHeapStatistics()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment