我试图在gcloud上构建一些东西,特别是一个带有yarn和node的网站。
这是我要运行的脚本:
"build:langs": "printenv && ls -lah node_modules/.bin && BABEL_ENV=test babel-node scripts/translate.js",
通孔
$ yarn run build:langs
哪些输出
https://gist.github.com/haf/ebc623bfce5520432c136e44496b58fb
–这里有趣的部分(格式化为可读性):
Step #2 - "js-build-langs":
PATH=/workspace/src/site.com/node_modules/.bin
:/usr/local/share/.config/yarn/link/node_modules/.bin
:/workspace/src/
...
total 40K
Step #2 - "js-build-langs": drwxr-xr-x 2 root root 4.0K Jun 3 19:18 .
Step #2 - "js-build-langs": drwxr-xr-x 1194 root root 36K Jun 3 19:19 ..
Step #2 - "js-build-langs": lrwxrwxrwx 1 root root 20 Jun 3 19:18 JSONStream -> ../JSONStream/bin.js
Step #2 - "js-build-langs": lrwxrwxrwx 1 root root 19 Jun 3 19:18 _mocha -> ../mocha/bin/_mocha
...
Step #2 - "js-build-langs": lrwxrwxrwx 1 root root 30 Jun 3 19:18 babel-node -> ../babel-cli/bin/babel-node.js
...
Step #2 - "js-build-langs": /bin/sh: 1: babel-node: not found
Step #2 - "js-build-langs": error Command failed with exit code 127.
Step #2 - "js-build-langs": info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
容器内生成器:
这还不算全部,因为在这场怪胎秀中,几分钟前(现在是:几个小时前):
cloudbuild目标看起来像:
steps:
# JS from https://console.cloud.google.com/gcr/images/cloud-builders/GLOBAL/yarn?gcrImageListsize=50:
- name: gcr.io/cloud-builders/yarn:node-8.11.0
waitFor: ["-"]
id: js-install
dir: src/site.com
args: ["install"]
- name: gcr.io/cloud-builders/yarn:node-8.11.0
waitFor: ["js-install"]
id: js-build-prod
dir: src/site.com
args: ["run", "build:prod"]
- name: gcr.io/cloud-builders/yarn:node-8.11.0
waitFor: ["js-build-prod"]
id: js-build-langs
dir: src/site.com
args: ["run", "build:langs"]
和packages.json snip:
"devDependencies": {
"@babel/core": "^7.0.0-beta.49",
"@babel/node": "^7.0.0-beta.49",
总而言之,我很困惑。为什么它不工作,尽管路径包含二进制js文件,这是可执行的非更少?为什么它能找到webpack却找不到babel节点?为什么我可以在本地运行它,即使在
git clean -fxd
?为什么有时会有用,但其他时候不行?
我的直觉告诉我这是GCB的某种种族状况