The Evolution of JavaScript in the Last Decade

Looking back at the last decade of JavaScript and the evolution of the web, it has been a truly remarkable journey. In 2010, JavaScript wasn’t as widely used as it is today. While I had JavaScript books from as early as 1998 in my library, I mainly used it in the form of Mootools and jQuery plugins. Although I wrote some glue code in JavaScript, it wasn’t anything groundbreaking. Back then, JavaScript was not considered a hot language, except for projects like GMail and Google Maps that required advanced work and large budgets....

The Guide to package.json for SEO-friendly Blogs

The package.json file is an essential component in many Node.js-based app codebases. If you work with JavaScript or have interacted with a JavaScript project, Node.js, or a frontend project, it’s likely that you are familiar with the package.json file. But what exactly is it for? What should you know about it, and what can you do with it? In this guide, we will explore the package.json file, its structure, and its properties....

The npx Node Package Runner: A Powerful Tool for Running Node Code

npx, a command available in npm since version 5.2, is an incredible tool for running Node code efficiently and comes packed with useful features. In the following post, I will introduce npx and explore its capabilities. Easily Run Local Commands Previously, Node developers used to publish executable commands as global packages to make them readily available in the path. However, this approach had limitations, mainly regarding version control. With npx, you can simply run npx commandname to automatically locate the correct reference of the command within the node_modules folder of your project....

Understanding npm dependencies and devDependencies

When working with npm packages, it’s important to understand the difference between dependencies and devDependencies. Knowing when to classify a package as a dependency or a dev dependency will help optimize your project’s setup. Dependencies When you run npm install <package-name>, the package is installed as a dependency. It is automatically added to the dependencies list in your package.json file. Previously, you had to manually specify --save to include it in the dependencies....

Understanding Peer Dependencies in Node Modules

In the package.json file of some Node modules, you might come across a field called peerDependencies. While you may be familiar with dependencies and devDependencies, peerDependencies is slightly different. Dependencies: These are the packages that your project relies on. DevDependencies: These are the packages that are necessary during the development phase, such as testing frameworks like Jest or utilities like Babel or ESLint. When you install a package using npm, both the dependencies and devDependencies are automatically installed....

Understanding the Behavior of `npm run dev` and Forcing it to Use Port 3000

One common question that comes up when working on a local website is related to the behavior of the npm run dev command. Each time this command is executed, it starts a long-running process that spins up a local development server. This practice is widely used in web development, and many tools like Astro and Next.js rely on the same command. However, one observation developers make is that each time they run npm run dev, the localhost port gets incremented....

Uninstalling npm packages with `npm uninstall`

Learn how to properly uninstall an npm Node package, whether it is installed locally or globally. To uninstall a package that was previously installed locally in the node_modules folder, you can run the following command from the project’s root folder: npm uninstall <package-name> This will not only remove the package from the node_modules folder but also remove its reference from the package.json file. If the package was installed as a development dependency and listed in the devDependencies section of the package....

What is pnpm? A Disk Space Saving Replacement for npm

Introduction to pnpm, a drop-in replacement for npm that helps reduce disk space usage. In a previous blog post, I discussed the issue of having huge node_modules folders and how it doesn’t necessarily have to be a bad thing. However, finding ways to reduce our hard drive consumption is always a plus, especially considering that newer computers in 2019 are shipping with smaller SSD drives. One way to address this is by centralizing the storage of library code and sharing it across all the projects we work on....

Where does npm install the packages?

How to Find Out Where npm Installs the Packages If you’re new to npm and want to learn more about it, check out the npm guide which covers all the basics. When you install a package using npm (or yarn), there are two types of installation you can perform: a local install or a global install. By default, when you run the npm install command like this: npm install lodash The package is installed in the current file tree under the node_modules subfolder....

Why Choose Node.js for Your Next Project?

When deciding on the best technology for your next project, there are countless alternatives to Node.js to consider. However, Node.js stands out as a compelling choice for a number of reasons. In this blog post, we will explore the benefits of using Node.js and why it may be the right solution for you. Node.js - Powered by JavaScript JavaScript is undoubtedly one of the most popular programming languages globally. Its ability to run within a web browser gives it a distinct advantage over other languages....