尝试通过yarn和pm2启动节点(next.js)应用程序时收到错误。我的谷歌搜索没有发现任何有用的东西。我怀疑问题出在 nvm 上,尽管我没有足够的经验来了解如何修复它。
Ubuntu 20.04
nvm 0.38.0
节点 v14.5.0
纱线 1.22.10
pm2 4.5.6
生态系统.config.js
module.exports = {
apps: [
{
name: "next",
script: "yarn",
interpreter: "bash",
args: "start:next",
instances: 1,
env: {
NODE_ENV: "development",
},
env_staging: {
NODE_ENV: "production",
},
env_production: {
NODE_ENV: "production",
}
}
]
Run Code Online (Sandbox Code Playgroud)
}
通过以下方式启动文件:
pm2 start ecosystem.config.js --env staging
Run Code Online (Sandbox Code Playgroud)
或者
pm2 start yarn --interpreter bash --name next -- start:next
Run Code Online (Sandbox Code Playgroud)
接收错误:
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/home/deploy/.pm2/pm2.log …Run Code Online (Sandbox Code Playgroud) 使用 React ^16.13.1 & Next ^9.4.4
试图让react-google-recaptcha-v3在我的应用程序中工作。
它似乎挂const result = await executeRecaptcha("homepage")在pages/index.js.
console.log(process.env.GOOGLE_RECAPTCHA_SITE_KEY) 返回正确的密钥。
硬编码密钥pages/_app.js会在浏览器中引发一些错误:
A cookie associated with a resource at http://google.com/ was set with `SameSite=None` but without `Secure`. It has been blocked, as Chrome now only delivers cookies marked `SameSite=None` if they are also marked `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5633521622188032.
A cookie associated with a cross-site resource at https://www.google.com/ …