英文:
Can't Resolve "encoding" Module Error While Using Nextjs-13 + Supabase
问题
我尝试使用Supabase来从我的表单中插入/收集数据。但当我编译时,出现了编码模块未找到的错误。我已经尝试过清除缓存和重新安装npm模块,但它们也没有起作用。
项目结构:
apply/page.tsx 代码:
"使用客户端"
import { supabase } from "lib/supabaseClient"
export default function Apply() {
// 此函数由按钮调用,因此我们在顶部使用 "使用客户端"。
async function createApplyRecord() {
const { error } = await supabase
.from('applications')
.insert({id: 1, fullname: "测试", email: "aa", phone: "bb", githuburl: "cc", linkedinurl: "dd", about: "ee"})
console.log("已插入")
if(error) {
console.log(error);
}
}
return (这里是一些HTML代码)
}
英文:
I'm trying to use Supabase for inserting/collecting data from my form. But when I compile I got encoding module is not found error. I already tried cache cleaning and re-installing npm modules. They didn't work either.
Project Structure:
apply/page.tsx Code:
"use client"
import { supabase } from "lib/supabaseClient"
export default function Apply() {
// This function called by button so we use "use client" at top.
async function createApplyRecord() {
const { error } = await supabase
.from('applications')
.insert({id: 1, fullname: "test", email: "aa", phone: "bb", githuburl: "cc", linkedinurl: "dd", about: "ee"})
console.log("inserted")
if(error) {
console.log(error);
}
}
return (SOME HTML CODE HERE)
}
答案1
得分: 30
这只是一个可以安全忽略的警告。我们正在努力移除它。您可以在这里跟踪:https://github.com/supabase/supabase-js/issues/612
英文:
This is just a warning that can be safely ignored. We're working on removing it. You can follow along here: https://github.com/supabase/supabase-js/issues/612
答案2
得分: 14
我运行了 npm install encoding
,然后错误消失了!
英文:
To fix this, I ran npm install encoding and the error was gone!
答案3
得分: 9
我使用了一个简单的解决方案,即使用
npm i -D encoding
但是Supabase社区应该已经解决了这个问题。然而,他们在Next 13的新版本中更改了身份验证模式。这是一个严重的问题,因为我不想重新做项目的身份验证。
英文:
I used a simple solution which was to use
> npm i -D encoding
But the supabase community should have already solved this problem. However, they changed the authentication mode with the new versions of next 13. Which is a serious problem because I didn't want to have to redo the authentication of my project.
答案4
得分: 2
更新到最新的Supabase版本。
问题已经修复。
通过https://github.com/supabase/supabase-js/issues/612#issuecomment-1713493284
大家好,你们能否在将supabase-js升级到v2.33.2之后检查错误是否仍然存在?
附注:如果你不得不安装编码作为一种解决方法,请也尝试卸载它。谢谢!
英文:
Update to the latest supabase version.
The issue is fixed
Via https://github.com/supabase/supabase-js/issues/612#issuecomment-1713493284
> Hey all, can you check if the errors are still there after upgrading supabase-js to v2.33.2?
> p.s. Please also try to uninstall encoding if you had to install that as a workaround. Thanks!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论