Skip to content

The common installation tutorial ​

WARNING

This tutorial is not exact for any package. Some package may have different ways to be installed.

CLI Tutorial ​

Downloading a Package Manager ​

To download a npm package, you must have a package manager. The most used package manager is npm. It is preincluded with Node.js Though we recommend installing pnpm as it is way faster than npm. Read more about pnpm's advantages here. If you want to know how to install pnpm, read this article

Using the CLI ​

To start, type your package manager's name in your CLI (powershell or command prompt on windows)

bash
npm -v

WARNING

The cli may not work! In such cases, visit your package managers's documentation.

Now, to install a specific package, do:

bash
[your package manager] add [package name]

Examples: ​


bash
pnpm add @briklab/lib
bash
npm add @briklab/lib
npm i @briklab/lib # also works

jsDelivr / CDN tutorial ​

Script tags ​

In your html file, enter this at the bottom of your <body>

html
<script src="https://cdn.jsdelivr.net/npm/@briklab/packagename@version/dist/index.min.js"></script>

In your .js file ​

To import a thing from a briklab package, use:

js
import {...} from "https://cdn.jsdelivr.net/npm/@briklab/packagename@version/dist/index.min.js"

Troubleshooting ​

npm command not found ​

  • install Node.js

  • restart terminal

  • check PATH variables

Permission error (EACCES) ​

Use:

bash
npm add [package] --force

or run terminal as administrator.

CDN not loading ​

  • check internet

  • verify package name/version

  • try unpkg.com alternative