[英]google cloud build - functions@: The engine "node" is incompatible with this module. Expected version "10"
I'm setting up cloud build trigger, how to set node version properly?我正在设置云构建触发器,如何正确设置节点版本? this is what I get:
这就是我得到的:
Already have image (with digest): gcr.io/cloud-builders/yarn yarn install v1.9.4 info No lockfile found.
已经有图像(带摘要):gcr.io/cloud-builders/yarn yarn install v1.9.4 info 找不到锁文件。 warning package-lock.json found.
警告 package-lock.json 发现。 Your project contains lock files generated by tools other than Yarn.
您的项目包含由 Yarn 以外的工具生成的锁定文件。 It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files.
建议不要混用package管理器,以免锁文件不同步导致解析不一致。 To clear this warning, remove package-lock.json.
要清除此警告,请删除 package-lock.json。 [1/5] Validating package.json... error functions@: The engine "node" is incompatible with this module.
[1/5] 验证 package.json...错误函数@:引擎“节点”与此模块不兼容。 Expected version "10".
预期版本“10”。 error Found incompatible module info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
错误发现不兼容的模块信息访问https://yarnpkg.com/en/docs/cli/install以获取有关此命令的文档。
package.json: package.json:
"engines": {
"node": "10"
}
.yaml is: .yaml 是:
steps:
- name: 'gcr.io/cloud-builders/yarn'
args: ['install']
dir: 'functions/autodeploy'
- name: 'gcr.io/cloud-builders/npm'
args: ['test']
dir: 'functions/autodeploy'
- name: 'gcr.io/cloud-builders/gcloud'
args: ['functions', 'deploy', 'someName', '--trigger-topic',
'some.topic.name', '--runtime', 'nodejs10']
dir: 'functions/autodeploy'
Solution achieved discussing within comments, summarizing how the issue was fixed:解决方案在评论中实现了讨论,总结了问题是如何解决的:
yarn
parameter --ignore-engines in the app.yaml
app.yaml
中使用yarn
参数--ignore-engines Specifying node version on the build yaml file steps, so it would look like this:在构建 yaml 文件步骤上指定节点版本,因此它看起来像这样:
steps: - name: 'gcr.io/cloud-builders/yarn:node-10.10.0' args: ['install', '--ignore-engines'] dir: 'functions/autodeploy' - name: 'gcr.io/cloud-builders/npm:node-10.10.0' args: ['test'] dir: 'functions/autodeploy' - name: 'gcr.io/cloud-builders/gcloud' args: ['functions', 'deploy', 'someName', '--trigger-topic', 'some.topic.name', '--runtime', 'nodejs10'] dir: 'functions/autodeploy'
I had the same error and removing the file yarn.lock resolved the problem我有同样的错误,删除文件 yarn.lock 解决了问题
For me it solved by deleting the yarn.lock file对我来说,它通过删除 yarn.lock 文件解决了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.