我正在开发 Nuxt 3 项目,当我使用 npm i 重新安装节点时,出现错误
The requested module 'node:stream' does not provide an export named 'getDefaultHighWaterMark'
。
我已删除
node-module
和 package-lock.json
文件并尝试运行 npm I 但它返回错误
我已经检查过不同的节点版本,例如
v19.3.0
v18.0.0
,但它不适用于任何版本。
我在这个 nuxt 3 项目中使用了 Element Plus
这是所有错误行
npm 启动
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: '^16 || ^18 || >= 20' },
npm WARN EBADENGINE current: { node: 'v19.0.0', npm: '8.19.2' }
npm WARN EBADENGINE }
> postinstall
> nuxt prepare
Nuxi 3.0.0 16:55:21
ERROR The requested module 'node:stream' does not provide an export named 'getDefaultHighWaterMark' 16:55:22
import {PassThrough as PassThroughStream, getDefaultHighWaterMark} from 'node:stream';
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'node:stream' does not provide an export named 'getDefaultHighWaterMark'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:518:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
at async installModule (/home/project/node_modules/@nuxt/kit/dist/index.mjs:416:3)
at async initNuxt (/home/project/node_modules/nuxt/dist/index.mjs:1825:7)
at async loadNuxt (/home/project/node_modules/nuxt/dist/index.mjs:1857:5)
at async loadNuxt (/home/project/node_modules/@nuxt/kit/dist/index.mjs:493:19)
at async Object.invoke (/home/project/node_modules/nuxi/dist/chunks/prepare.mjs:30:18)
at async _main (/home/project/node_modules/nuxi/dist/cli.mjs:50:20)
npm ERR! code 1
npm ERR! path /home/project
npm ERR! command failed
npm ERR! command sh -c -- nuxt prepare
我也遇到同样的问题,试试
npm install --force