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/

原因

模块不兼容

目录
相关文章
|
4月前
Node——activeError: error:0308010C:digital envelope routines::unsupported
启动项目报错error:0308010C:digital envelope routines::unsupported,其实很简单因为node版本的原因,本地默认的版本是v20.15.0,项目是老项目默认的版本是v16.16.0;
113 2
|
2月前
|
存储 开发框架 JavaScript
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
75 0
Node.js实现短链接(ShortLink):shortid、epxress让URL更简单
|
4月前
Mac 安装 Node Error: Could not symlink include/node/common.gypi
Mac 安装 Node Error: Could not symlink include/node/common.gypi
38 3
|
4月前
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
53 3
|
4月前
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
117 2
|
4月前
|
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)
104 0
|
4月前
|
JavaScript 前端开发
NodeJs——error:03000086:digital envelope routines::initialization error
NodeJs——error:03000086:digital envelope routines::initialization error
72 0
|
4月前
|
JavaScript
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
46 0
|
4月前
|
缓存 资源调度 JavaScript
Nodejs 命令行调用 exec 与 spawn 差异--- 解决 spawn yarn ENOENT error
Nodejs 命令行调用 exec 与 spawn 差异--- 解决 spawn yarn ENOENT error