JavaScript

2021-08-22

  • 1 Basics
  • 2 Advanced
    • 2.1 NPM
      • 2.1.1 Install package globally
      • 2.1.2 Use the installed package
      • 2.1.3 List installed packages

1 Basics

2 Advanced

2.1 NPM

2.1.1 Install package globally

npm i -g playwright

2.1.2 Use the installed package

Install a package and then import it in a .js file. Run it by node file.js. It reports that the module is not found. The reason is that NODE_PATH is not set up. Solution: Add the following line to .bashrc

export NODE_PATH=$NODE_PATH:`npm root -g`

2.1.3 List installed packages

npm list -g --depth=0
.
Created on 2021-08-22 with pandoc