vite proxy axios出现TypeError: Cannot read property 'split' of null
Author:zhoulujun Date:
今天把之前vue bkui-cli 创建的项目copy 值vite 工程。发现报错:
ERROR 10:28:35 AM [vite] Internal server error: Cannot read properties of null (reading 'split')
ERROR 10:28:35 AM [vite] Internal server error: Cannot read properties of null (reading 'split')
at required (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:55482:23)
at Object.common.setupOutgoing (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:55610:7)
at Array.stream (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:56621:16)
at ProxyServer.<anonymous> (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:56934:21)
at viteProxyMiddleware (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:57190:23)
at call (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:44106:7)
at next (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:44050:5)
at cors (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:44574:7)
at /Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:44610:17
at originCallback (/Userszhoulujun/workspace/vite-vue3-tsx/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:44600:15)
google 找到了答案,记录一下:https://github.com/PanJiaChen/vue-element-admin/issues/3285#issuecomment-728670320
我是这解决的,devServer.proxy.target需要提供完整的url,如http://www.xxx.com, 缺少http,就会报上述错误
这个报错真的打疼,一点提示都没有,安装上面的改了,就好了
转载本站文章《vite proxy axios出现TypeError: Cannot read property 'split' of null》,
请注明出处:https://www.zhoulujun.cn/html/tools/Bundler/vite/8840.html
延伸阅读:
- 新一代构建工具(2):从bundler角度看esbuild
- 新一代构建工具(1):对比rollup/parcel/esbuild—esbuild脱颖而出
- 新一代构建工具(3):Vite站在巨人的肩膀——vite快的理由
- vitepress搭建markdown文档博客
- vite启动localhost:5000 responds with http status 403无法访问
- Vitepress自动生成侧边栏函数—自动读取目录生成侧边栏
- algolia配置站内搜索:vitepress配置示范
- vite组件按需导入:vite-plugin-babel-import vs vite-plugin-style-import
- vitepress页面渲染不出来,出现404原因分析——vue变量
- vitepress build error: TypeError: Invalid value used as weak map key
- vitepress 打包内存溢出: JavaScript heap out of memory
- vite项目sass变量找不到报错
- vitepress本地无法预览:HTTP ERROR 403
- Bundler取舍:抛弃vite改投rspack?