我的代码都在本地起作用(运行节点17.4.0)。
但是正如我所提到的,检测到的节点版本17.4.0 (这与我用于本地开发的版本相同),函数丢弃错误:
-
typeError:(0,crypto__webpack_imported_module_0__。 Randomuuid)(...)。替换不是函数
。
-
typeError :(中间值).format(...)。替换不是getShortLocalizedDate的函数
我如何确保如何在生产服务器上使用 fellAceall
可以在我的生产服务器上工作?
ps我认为节点支持替换
,因为 v15 。
My code all works locally (running Node 17.4.0).
But as I mentioned here, when I deploy to my production server at Render.com, which says Detected Node version 17.4.0
(which is the same version that I use for local development), functions throw errors like:
TypeError: (0 , crypto__WEBPACK_IMPORTED_MODULE_0__.randomUUID)(...).replaceAll is not a function
.
TypeError: (intermediate value).format(...).replaceAll is not a function at getShortLocalizedDate
How can I ensure that replaceAll
can work on my production server?
P.S. I think Node has supported replaceAll
since v15.
发布评论
评论(2)
需要检查的某些内容:您是否还有其他内容覆盖
node.node
中的节点版本?根据 https://render.com/docs/node-version .Node 值将被node_version
环境变量.node-version
file 文件文件 file a repo.nvmrc
。 >文件在您的存储库的根部。另外,当您在渲染上部署时,您是否将节点选择为环境?
这是我创建的一个小测试,以验证奇数节点版本编号在渲染上起作用,并验证
preplaceAll()
在节点v17.4.0中起作用。代码(也 https://github.com/crcastle/test-replaceall < /a>)
server.js
:package.json
:output (也临时部署到 https://test-replaceall.onrender.com )
构建和部署日志
Some things to check: Do you maybe have something else overriding the Node version set in
engines.node
? According to https://render.com/docs/node-version, theengines.node
value will be overridden byNODE_VERSION
environment variable.node-version
file at the root of your repo.nvmrc
file at the root of your repo.Also, when you deploy on Render, are you selecting Node as the Environment?
Here's a small test deploy to Render I created to verify that odd Node version numbers work on Render and also to verify that
replaceAll()
works in Node v17.4.0.Code (also at https://github.com/crcastle/test-replaceall)
server.js
:package.json
:Output (also temporarily deployed to https://test-replaceall.onrender.com)
Build and deploy log
https://render.com/docs/node-version 似乎不完整。
我想知道渲染是否忽略了奇数的节点版本。
我在“环境变量”中指定了17.4.0,也指定了
package.json
,但我仍然看到部署日志说“检测到的节点版本18.3.0”,然后是>替换
莫名其妙地行不通。最近,我已经指定了
node_version = 18.3.0
在“环境变量”中,我什至添加到package.json
:“发动机”:{”节点“:”&gt; = 18.3.0&lt; 19“},
。 再次说:Jun 15 04:16:34 pm ==&gt;检测到的节点版本18.3.0
。这次
替换
有效!因此,我的解释是:
检测到的节点版本___
无法依靠部署日志中所示。这是神秘的。但是我很高兴我的代码现在正在工作!
https://render.com/docs/node-version seems incomplete.
I wonder if Render ignores odd-numbered Node versions.
I'd specified 17.4.0 in the environment variables and also in
package.json
, but then I'd still see the deployment log say "Detected Node version 18.3.0", and thenreplaceAll
inexplicably still wouldn't work.More recently I've specified
NODE_VERSION=18.3.0
in the environment variables, and I've even added topackage.json
:"engines": { "node": ">=18.3.0 <19" },
. The latest deployment log at https://dashboard.render.com/web/srv-caevvv7ho1kse31neb0g/deploys/dep-cal3r7vh8vl4d0g8vujg again said:Jun 15 04:16:34 PM ==> Detected Node version 18.3.0
.And this time
replaceAll
works!So my interpretation is:
Detected Node version ___
shown in deployment logs cannot be relied upon.It's mysterious. But I'm glad my code is working now!