将应用程序部署到本地服务器时,环境变量未加载
我将此应用程序连接到 Moralis 。 控制台中没有错误。 我期望在终端中看到这一点...
Info- loaded env from …
i 硬编码我的env变量,因为这是唯一起作用的东西。 使用“ next_public_”给了我错误。
env.local
serverUrl = 'https://8oyk5t00zoyz.usemoralis.com:2053/server'
appId = 'l9iAGdkJCtFrMAlp8ot12XVtgbeXiwul9iKhgZD9'
_app.js
function MyApp({ Component, pageProps }) {
return (
<MoralisProvider
serverUrl= 'https://8oyk5t00zoyz.usemoralis.com:2053/server'
appId= 'l9iAGdkJCtFrMAlp8ot12XVtgbeXiwul9iKhgZD9'
>
<Component {...pageProps} />
</MoralisProvider >
)
}
export default MyApp
index.js
const styles = {
container: `h-full w-full flex bg-[#fff]`
}
export default function Home() {
return (
<div className={styles.container}>
<Sidebar />
{/*<Main/> */}
</div>
)
}
I am connecting this app to Moralis.
There are no errors in the console.
I am expecting to see this in the Terminal...
Info- loaded env from …
I hardcoded my env variables because it's the only thing that would work.
Using "NEXT_PUBLIC_" gave me errors.
env.local
serverUrl = 'https://8oyk5t00zoyz.usemoralis.com:2053/server'
appId = 'l9iAGdkJCtFrMAlp8ot12XVtgbeXiwul9iKhgZD9'
_app.js
function MyApp({ Component, pageProps }) {
return (
<MoralisProvider
serverUrl= 'https://8oyk5t00zoyz.usemoralis.com:2053/server'
appId= 'l9iAGdkJCtFrMAlp8ot12XVtgbeXiwul9iKhgZD9'
>
<Component {...pageProps} />
</MoralisProvider >
)
}
export default MyApp
index.js
const styles = {
container: `h-full w-full flex bg-[#fff]`
}
export default function Home() {
return (
<div className={styles.container}>
<Sidebar />
{/*<Main/> */}
</div>
)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论