npm

You probably want to first do

npm install

Then you can do something like:

npm run <script_name>

For example, for this package.json,

{
  "name": "helia-nextjs",
  "version": "1.0.0",
  "description": "Using Helia with nextjs",
  "private": true,
  "type": "module",
  "scripts": {
    "clean": "rimraf ./dist ./.next",
    "dev": "next dev",
    "build": "next build && next export -o dist",
    "serve": "npm run dev",
    "start": "next start",
    "lint": "next lint",
    "test": "npm run build && test-browser-example test"
  },
  "dependencies": {
    "helia": "^1.0.0",
    "next": "^13.2.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@playwright/test": "^1.32.1",
    "eslint": "^8.36.0",
    "eslint-config-next": "^13.2.4",
    "interface-datastore": "^8.2.0",
    "playwright": "^1.32.1",
    "rimraf": "^5.0.0",
    "test-ipfs-example": "^1.0.0"
  }
}

You run

npm run build

From CS349

Install a package from the npm library/registry

npm install <package> or npm i <package>
  • install options —save-dev # package is for development only -g # install package globally (i.e. in your system)

List installed packages

npm list or npm list –g # to list global packages

Initialize Node project

npm init or npm create # alias for init

Run script

npm run <script-name>

Execute package

npm exec <package>

Update a package

npm update <package> or npm up <package>