Error: Cannot find module ‘node:url‘【已解决】

简介: Error: Cannot find module ‘node:url‘【已解决】

异常信息

failed to load config from D:\javapub\chat\chatgpt-vue\vite.config.ts
error during build:
Error: Cannot find module 'node:url'
Require stack:
- D:\javapub\chat\chatgpt-vue\vite.config.ts
- D:\javapub\chat\chatgpt-vue\node_modules\vite\dist\node\chunks\dep-ca21228b.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (D:\javapub\chat\chatgpt-vue\vite.config.ts:36:23)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object._require.extensions.<computed> [as .js] (file:///D:/javapub/chat/chatgpt-vue/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62356:24)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
failed to load config from D:\javapub\chat\chatgpt-vue\vite.config.ts
error during build:
Error: Cannot find module 'node:url'
Require stack:
- D:\javapub\chat\chatgpt-vue\vite.config.ts
- D:\javapub\chat\chatgpt-vue\node_modules\vite\dist\node\chunks\dep-ca21228b.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (D:\javapub\chat\chatgpt-vue\vite.config.ts:36:23)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object._require.extensions.<computed> [as .js] (file:///D:/javapub/chat/chatgpt-vue/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62356:24)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)

解决

建议直接用终极解决办法,升级 node 版本

https://nodejs.cn/download/current/

原因

模块不兼容

目录
相关文章
|
3月前
Node——activeError: error:0308010C:digital envelope routines::unsupported
启动项目报错error:0308010C:digital envelope routines::unsupported,其实很简单因为node版本的原因,本地默认的版本是v20.15.0,项目是老项目默认的版本是v16.16.0;
103 2
|
30天前
|
存储 开发框架 JavaScript
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
53 0
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
|
3月前
Mac 安装 Node Error: Could not symlink include/node/common.gypi
Mac 安装 Node Error: Could not symlink include/node/common.gypi
30 3
|
3月前
optional install error: Error: Unsupported URL Type: npm:vue-loader@^16.1.0
optional install error: Error: Unsupported URL Type: npm:vue-loader@^16.1.0
49 3
|
3月前
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
90 2
|
3月前
|
JavaScript Linux Windows
【应用服务 App Service】NodeJS +Egg 发布到App Service时遇见 [ERR_SYSTEM_ERROR]: A system error occurred:uv_os_get_passwd returned ENOENT(no such file or directory)
【应用服务 App Service】NodeJS +Egg 发布到App Service时遇见 [ERR_SYSTEM_ERROR]: A system error occurred:uv_os_get_passwd returned ENOENT(no such file or directory)
|
3月前
|
JavaScript 前端开发
NodeJs——error:03000086:digital envelope routines::initialization error
NodeJs——error:03000086:digital envelope routines::initialization error
65 0
|
3月前
|
JavaScript
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
33 0
|
2月前
|
JavaScript
NodeJs的安装
文章介绍了Node.js的安装步骤和如何创建第一个Node.js应用。包括从官网下载安装包、安装过程、验证安装是否成功,以及使用Node.js监听端口构建简单服务器的示例代码。
NodeJs的安装