[Daily Problems] Manually install npm packages globally offline

foreword

When making a new purpose, I need npm to install the package @graphprotocol/graph-cli, but I found that the library cannot be connected to the Internet, so I asked my colleagues for dependencies, researched it myself, and installed it manually globally.

Prerequisites

  1. npm needs to be installed
  2. The package to install.

installation steps

  • View the package path of the local npm -g
npm root -g
  • Copy the package to this path
  • Execute the command to install the package, take this example as an example:
npm i -g @graphprotocol/[email protected]
  • Successful installation
    insert image description here

Notice

If it doesn't work, you can clear the cache first:

npm cache clean -f

Be sure to execute step 3, otherwise execute

npm list -g --depth 0

It will happen:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43742184/article/details/117449687