⊗jsSpTlNI 184 of 294 menu

Installing libraries via npm in JavaScript

With npm, installing the necessary library is very easy. You need to open a terminal in your project folder and run the following command:

npm install library_name

For example, let's install the lodash library:

npm install lodash

The installed library will be locate in the node_modules folder. In this case, if the library has dependencies, they will also be installed in this folder as separate libraries.

Libraries installed via npm can be included in an HTML file. But you shouldn't do this, since they are modules. Such libraries should be included in a special way. We will go through this in the next sections of the tutorial. In the meantime, we just learn how to install libraries via npm.

Install the underscorejs library via npm. Examine the node_modules folder.

Install the jQuery library via npm. Examine the node_modules folder.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline