npm (Node Package Manager) is a package manager for JavaScript, commonly used with Node.js. 

npm allows developers to share and reuse code, as well as manage project dependencies. 

Here’s how npm works on the IBM i system:

Installation

To use npm on IBM i, you first need to install Node.js. This can be done through the IBM i Open Source Solutions (5733OPS) licensed program1. Once Node.js is installed, npm is typically included by default.

Key Features

  • Package Management: npm allows you to install, update, and manage JavaScript packages. This is particularly useful for managing dependencies in your Node.js applications.
  • Script Running: You can define scripts in your package.json file and run them using npm. This is useful for automating tasks like testing, building, and deploying your applications.
  • Version Control: npm helps in managing different versions of packages, ensuring compatibility and stability in your projects.

Usage on IBM i

Installing Packages: You can install packages from the npm registry using the npm install command.

For example, to install the express package, you would run:

npm install express

Running Scripts: Define scripts in your package.json file and run them using npm run.

For example, to start your application, you might have a script like:

"scripts": {
"start": "node app.js"
}

You can then run it with:

npm run start

Accessing IBM i Resources:

There are npm packages specifically designed to interact with IBM i resources.

For example, the itoolkit package allows you to call RPG, CL, and other IBM i programs2.

Example Workflow

  • Set Up Node.js and npm: Install Node.js and npm on your IBM i system.
  • Initialize a Project: Create a new project with npm init, which will generate a package.json file.
  • Install Dependencies: Use npm install to add necessary packages.
  • Develop and Test: Write your application code and use npm scripts to automate testing and other tasks.
  • Deploy: Deploy your application using npm scripts or other deployment tools.
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>