节点获取:不支持的 URL 类型“节点:”:节点:缓冲区

Tom*_*Tom 6 node.js node-fetch

我需要让Node-fetch为 VUE JS 项目工作,但我遇到了这些依赖项错误:

These dependencies were not found:

* node:buffer in ./node_modules/node-fetch/src/index.js, ./node_modules/node-fetch/src/body.js
* node:http in ./node_modules/node-fetch/src/index.js, ./node_modules/node-fetch/src/headers.js
* node:https in ./node_modules/node-fetch/src/index.js
* node:net in ./node_modules/node-fetch/src/utils/referrer.js
* node:stream in ./node_modules/node-fetch/src/index.js, ./node_modules/node-fetch/src/body.js
* node:url in ./node_modules/node-fetch/src/request.js
* node:util in ./node_modules/node-fetch/src/body.js, ./node_modules/node-fetch/src/headers.js and 1 other
* node:zlib in ./node_modules/node-fetch/src/index.js

To install them, you can run: npm install --save node:buffer node:http node:https node:net node:stream node:url node:util node:zlib
Run Code Online (Sandbox Code Playgroud)

我尝试run npm install --save node:buffer node:http node:https node:net node:stream node:url node:util node:zlib但收到此错误:

npm 错误!代码 EUNSUPPORTEDPROTOCOL npm 错误!不支持的 URL 类型“node:”:node:buffer

如何安装缺少的依赖项?

(我在 UBUNTU 18.04.6 LTS 上使用 NODE JS v16.13.2)

小智 1

在没有 (node:) 的情况下运行此命令:

npm install --save buffer http https net stream url util zlib
Run Code Online (Sandbox Code Playgroud)