Getting started with Node.jsnpmWeb Apps With ExpressFilesystem I/OExporting and Consuming ModulesExporting and Importing Module in node.jsInstalling Node.jsMySQL integrationReadlinepackage.jsonEvent EmittersAutoreload on changesEnvironmentCallback to PromiseExecuting files or commands with Child ProcessesCluster ModuleException handlingKeep a node application constantly runningUninstalling Node.jsnvm - Node Version ManagerhttpUsing StreamsDeploying Node.js applications in productionSecuring Node.js applicationsMongoose Libraryasync.jsFile uploadSocket.io communicationMongodb integrationHandling POST request in Node.jsSimple REST based CRUD APITemplate frameworksNode.js Architecture & Inner WorkingsDebugging Node.js applicationNode server without frameworkNode.JS with ES6Interacting with ConsoleCassandra IntegrationCreating API's with Node.jsGraceful ShutdownUsing IISNode to host Node.js Web Apps in IISCLINodeJS FrameworksgruntUsing WebSocket's with Node.JSmetalsmithParsing command line argumentsClient-server communicationNode.js Design FundamentalConnect to MongodbPerformance challengesSend Web NotificationRemote Debugging in Node.JSMysql Connection PoolDatabase (MongoDB with Mongoose)Good coding styleRestful API Design: Best PracticesDeliver HTML or any other sort of fileTCP SocketsHackBluebird PromisesAsync/AwaitKoa Framework v2Unit testing frameworksECMAScript 2015 (ES6) with Node.jsRouting ajax requests with Express.JSSending a file stream to clientNodeJS with RedisUsing Browserfiy to resolve 'required' error with browsersNode.JS and MongoDB.Passport integrationDependency InjectionNodeJS Beginner GuideUse Cases of Node.jsSequelize.jsPostgreSQL integrationHow modules are loadedNode.js with OracleSynchronous vs Asynchronous programming in nodejsNode.js Error ManagementNode.js v6 New Features and ImprovementEventloopNodejs Historypassport.jsAsynchronous programmingNode.js code for STDIN and STDOUT without using any libraryMongoDB Integration for Node.js/Express.jsLodashcsv parser in node jsLoopback - REST Based connectorRunning node.js as a serviceNode.js with CORSGetting started with Nodes profilingNode.js PerformanceYarn Package ManagerOAuth 2.0Node JS LocalizationDeploying Node.js application without downtime.Node.js (express.js) with angular.js Sample codeNodeJs RoutingCreating a Node.js Library that Supports Both Promises and Error-First CallbacksMSSQL IntergrationProject StructureAvoid callback hellArduino communication with nodeJsN-APIMultithreadingWindows authentication under node.jsRequire()Route-Controller-Service structure for ExpressJSPush notifications

nvm - Node Version Manager

Other topics

Remarks:

The urls used in the above examples reference a specific version of Node Version Manager. It is most likely that the latest version is different to what's being referenced. To install nvm using the latest version, click here to access nvm on GitHub, which will provide you with latest urls.

Install NVM

You can use curl:

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

Or you can use wget:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash

Check NVM version

To verify that nvm has been installed, do:

command -v nvm

which should output 'nvm' if the installation was successful.

Installing an specific Node version

Listing available remote versions for installation

nvm ls-remote

Installing a remote version

nvm install <version>

For example

nvm install 0.10.13

Using an already installed node version

To list available local versions of node through NVM:

nvm ls

For example, if nvm ls returns:

$ nvm ls
     v4.3.0
     v5.5.0

You can switch to v5.5.0 with:

nvm use v5.5.0

Install nvm on Mac OSX

INSTALLATION PROCESS

You can install Node Version Manager using git, curl or wget. You run these commands in Terminal on Mac OSX.

curl example:

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

wget example:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash

TEST THAT NVM WAS PROPERLY INSTALLED

To test that nvm was properly installed, close and re-open Terminal and enter nvm. If you get a nvm: command not found message, your OS may not have the necessary .bash_profile file. In Terminal, enter touch ~/.bash_profile and run the above install script again.

If you still get nvm: command not found, try the following:

  • In Terminal, enter nano .bashrc. You should see an export script almost identical to the following:

export NVM_DIR=”/Users/johndoe/.nvm” [ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh”

  • Copy the export script and remove it from .bashrc
  • Save and Close the .bashrc file (CTRL+O – Enter – CTRL+X)
  • Next, enter nano .bash_profile to open the Bash Profile
  • Paste the export script you copied into the Bash Profile on a new line
  • Save and Close the Bash Profile (CTRL+O – Enter – CTRL+X)
  • Finally enter nano .bashrc to re-open the .bashrc file
  • Paste the following line into the file:

source ~/.nvm/nvm.sh

  • Save and Close (CTRL+O – Enter – CTRL+X)
  • Restart Terminal and enter nvm to test if it's working

Setting alias for node version

If you want to set some alias name to installed node version, do:

nvm alias <name> <version>

Similary to unalias, do:

nvm unalias <name>

A proper usecase would be, if you want to set some other version than stable version as default alias. default aliased versions are loaded on console by default.

Like:

nvm alias default 5.0.1

Then every time console/terminal starts 5.0.1 would be present by default.

Note:

nvm alias # lists all aliases created on nvm

Run any arbitrary command in a subshell with the desired version of node

List all the node versions installed

nvm ls
    v4.5.0
    v6.7.0

Run command using any node installed version

nvm run 4.5.0 --version or nvm exec 4.5.0 node --version
Running node v4.5.0 (npm v2.15.9)
v4.5.0

nvm run 6.7.0 --version or nvm exec 6.7.0 node --version
Running node v6.7.0 (npm v3.10.3)
v6.7.0

using alias
nvm run default --version or nvm exec default node --version
Running node v6.7.0 (npm v3.10.3)
v6.7.0

To install node LTS version

nvm install --lts

Version Switching

nvm use v4.5.0 or nvm use stable ( alias )

Contributors

Topic Id: 2823

Example Ids: 8772,8773,8774,8775,9545,18422,24408

This site is not affiliated with any of the contributors.