How to properly configure node and npm

Опубликовано: 14 Апрель 2026
на канале: The Startup Lab
10,596
78

In this video, we walk through setting up your development environment to use tools like node and npm for your javascript development.

We'll also look at how to easily handle different versions of node with tools like n



-----------------------------------------------------------
Instructions
-----------------------------------------------------------
Install node and npm
https://nodejs.org/en/

Create a new directory for our npm tools.
mkdir ~/.npm-packages

Tell npm to use our new directory
npm config set prefix ~/.npm-packages

Check to see our new directory is being used for global modules
npm list -g —depth=0

Register the new location under our $PATH variable in ~/.bashrc
sudo vi ~/.bashrc

Update PATH variable
PATH=$PATH:/{path}/{to}/{directory}/.npm-packages/bin

Source the file in bash_profile
source ~/.bashrc

Install “n” to toggle node versions
npm install -g n

Install versions of node
sudo n v8.6.4

Open node menu with “n”



Visit The Startup Lab
---------------------------------------------------------
https://www.thestartuplab.io

Work with us to build your project
---------------------------------------------------------
https://www.thestartuplab.io/contact

Follow us on our social network pages
---------------------------------------------------------
Facebook:   / thestartuplabtx  
Instagram:   / thestartuplab  
Twitter:   / thestartuplabtx  

Code with us
---------------------------------------------------------
https://github.com/TheStartupLab