Etiqueta Node

Quick File Server

Let's install a Quick File Server to serve files from a folder, we can use the serve package. Let's start by installing it using the following command $ npm install serve in your terminal.

Begin Your Node.js Project with package.json Setup

To start a Node.js project, you need a package.json file, which acts as a project manifest. Use the $ npm init command to create it, providing details like project name, version, description, entry point, and author. This file manages dependencies, scripts, and metadata, forming the foundation for your Node.js project.

Efficient Node.js Installation with FNM

How Not to Install Node.js: A Better Way with fnm

When it comes to installing Node.js, not all methods are created equal. Many developers rely on their operating system's package managers, such as apt-get on Debian/Ubuntu, Brew on macOS, or Chocolatey on Windows. However, this approach often leads to outdated versions, inconsistent file placement, and potential security risks when using sudo to install global npm packages. Even downloading directly from the Node.js website has its drawbacks, particularly on macOS and Linux, where sudo is still required for global libraries.

Enter fnm: The Fast Node Manager
fnm (Fast Node Manager) is a lightweight and cross-platform tool designed to simplify Node.js version management. It allows seamless installation, uninstallation, and version switching based on the project directory. Compatible with popular shells like Bash, Zsh, and PowerShell, fnm integrates with .node-version and .nvmrc files, making it a fast and secure choice for managing Node.js versions.