[英]Does Google Cloud App Engine have a special Node.js runtime?
I tried to deploy my Node.js app on Google Cloud using a flexible App Engine. 我尝试使用灵活的App Engine在Google Cloud上部署Node.js应用程序。 On my local machine the project runs without errors, but on the cloud, it produces strange errors 在我的本地计算机上,项目运行没有错误,但是在云上却产生了奇怪的错误
Like the one, where I need to require
the URL
class, otherwise it's undefined, while on my machine it works without the require
. 喜欢的人,我要在require
的URL
类,否则它是不确定的,而我的机器上它的工作原理没有require
。 Another one I still couldn't figure out is when I Proxy
the global Promise
object, it comes back as a function, but mongoose fails to load, because global.Promise
is not a function. 我仍然不知道的另一个是,当我Proxy
全局Promise
对象时,它作为一个函数返回,但是猫鼬无法加载,因为global.Promise
不是一个函数。
I'm on the latest Node LTS version and using Yarn, so the dependencies definitely have the correct version. 我使用的是最新的Node LTS版本并使用Yarn,因此依赖项肯定具有正确的版本。 Is there a different Node.js runtime I'm not aware of? 有我不知道的其他Node.js运行时吗? Or is it an environment setting I can set? 还是我可以设置的环境设置?
Edit: These errors happen during build (maybe that has something to do with it?) 编辑:这些错误发生在构建过程中(也许与它有关?)
So it turns out the Google Cloud Builder doesn't use the latest node version by default. 因此,事实证明Google Cloud Builder默认不使用最新的节点版本。 I needed to specify it in the cloudbuilder.yaml
, eg: 我需要在cloudbuilder.yaml
指定它,例如:
steps:
- name: "gcr.io/cloud-builders/yarn:node-10.10.0"
args: ["install", "--production"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.