-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tutorial] Installing nodejs and npm #287
base: master
Are you sure you want to change the base?
Changes from 7 commits
b017b46
513d97e
7544fed
bf00de7
11a639b
930033a
d6cf3a0
3ac7f8e
e6a07cc
157ce84
81eeeed
35843e4
2eca2a4
c4fb34d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# How to install and setup NodeJS and npm? | ||
- **step 1:** | ||
Open the Terminal on your Ubuntu system. You can do this by pressing the **"Ctrl+Alt+T"** keys simultaneously. | ||
- **step 2:** | ||
Update your package list by typing the following command in the Terminal: | ||
|
||
`sudo apt-get update` | ||
- **step3:** | ||
Install Nodejs using the following command: | ||
|
||
`sudo apt get install node js` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this correct? I don't think this will work. is the package There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, there is no space in between |
||
- **step4:** | ||
Check if Node.js is installed by typing the following command: | ||
|
||
`node -v` | ||
|
||
This will display the version number of Node.js installed on your system. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding example output of the commands. this will help people understand if the command has executed correctly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will surely add some screenshorts |
||
- **step5:** | ||
Install NPM (Node Package Manager) by typing the following command: | ||
|
||
`sudo apt-get install npm` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually installing the NodeJS package installs npm alongwith. Please check if this is correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
- **step6:** | ||
Check if NPM is installed by typing the following command: | ||
|
||
`npm -v` | ||
- **step7:** | ||
If you encounter any issues with the installation, you can try updating the package list again by typing the following command: | ||
|
||
`sudo apt-get update` | ||
|
||
Then repeat steps 3-6. | ||
## Steps to update the nodejs and npm versions | ||
|
||
- **step 1:** | ||
Open the Terminal on your Ubuntu system. | ||
- **step 2:** | ||
Check the currently installed versions of Node.js and NPM by typing the following commands: | ||
|
||
`node -v npm -v` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. two separate commands usually need to be separated with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
- **step3:** | ||
To update Node.js, you can use the Node Version Manager (nvm) tool. If you do not have nvm installed, you can install it using the following command: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this section should contain steps to update NodeJS and NPM without using NVM. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the question, it was mentioned with using nvm, we will surely add without using nvm too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
curl -o- [https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh](https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh) | bash | ||
- **step4:** | ||
Once nvm is installed, you can use it to install the latest version of Node.js by typing the following command: | ||
|
||
`nvm install node` | ||
|
||
This will install the latest version of Node.js. You can verify the version by typing the following command: | ||
|
||
`node -v` | ||
- **step5:** | ||
To update NPM to the latest version, you can use the following command: | ||
|
||
`npm install -g npm@latest` | ||
|
||
This will install the latest version of NPM globally. You can verify the version by typing the following command: | ||
|
||
`npm -v` | ||
|
||
If you want to update NPM for a specific project, you can navigate to the project directory and run the above command without the -g flag. | ||
## How to manage multiple versions of node.js and npm using nvm | ||
|
||
- **Step1:** | ||
Install nvm on your Ubuntu system by running the following command in your terminal: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be repeated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah will surely check |
||
|
||
` curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash` | ||
|
||
This will download and install the latest stable version of nvm. | ||
- **Step2:** | ||
Once nvm is installed, you can use it to install and manage different versions of Node.js by running the following command: | ||
|
||
`nvm install <node_version>` | ||
|
||
Replace **<node_version>** with the version of Node.js you want to install, such as "14.18.1". This will download and install the specified version of Node.js. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding some info about LTS versions of NPM and how to install / use them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
||
- **Step3:** | ||
use a specific version of Node.js, you can run the following command: | ||
|
||
`nvm use <node_version>` | ||
|
||
This will set the specified version of Node.js as the active version. | ||
|
||
- **Step4:** | ||
You can also set a default version of Node.js by running the following command: | ||
|
||
`nvm alias default <node_version>` | ||
|
||
This will set the specified version of Node.js as the default version that will be used when you open a new terminal window. | ||
|
||
- **Step5:** | ||
To check the currently installed versions of Node.js, you can run the following command: | ||
|
||
`nvm ls` | ||
|
||
This will show a list of all the installed versions of Node.js. | ||
- **Step6:** | ||
To uninstall a specific version of Node.js, you can run the following command: | ||
|
||
`nvm uninstall <node_version>` | ||
|
||
Replace **<node_version>** with the version of Node.js you want to uninstall. | ||
|
||
With these steps, you can manage multiple versions of Node.js and npm on Ubuntu using nvm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Use code block to represent commands or keys
for ex:
Ctrl+Alt+T
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok done