官网:https://github.com/ChainSafe/web3.js

使用node安装  npm install web3

linlin@linlin-i5:/workspace/blockchain/contract_on_goerli_using_infura$ npm install web3

up to date, audited 378 packages in 3s

65 packages are looking for funding
  run `npm fund` for details

4 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Use the prebuilt

dist/web3.min.js
, or build using the web3.js repository:

npm run build

npm run build
npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/linlin/.npm/_logs/2022-07-26T03_59_06_618Z-debug.log

Then include

dist/web3.min.js
in your html file. This will expose
Web3
on the window object.

Or via jsDelivr CDN:

<span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>=&quot;<span class="pl-s">https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js</span>&quot;<span class="pl-kos">&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>

UNPKG:

<span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">src</span>=&quot;<span class="pl-s">https://unpkg.com/web3@latest/dist/web3.min.js</span>&quot;<span class="pl-kos">&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>