Google Angular 的 Cloud Builder 在使用 Cloud Builders Community 图像安装节点 SASS 期间失败
Google Cloud Builder for Angular fails during Node SASS installation using Cloud Builders Community image
到目前为止我完成的步骤:
- 我创建了一个
Google Cloud Repository
- 我创建了一个
Cloud Build Trigger
并将其链接到我的 GitHub 帐户和存储库,并与分支名称完全匹配 ^staging$
现在根据 the guide 我正在尝试使用以下代码初始化 angular 生成器:
git clone https://github.com/GoogleCloudPlatform/cloud-builders-community
cd cloud-builders-community/ng
gcloud builds submit --config cloudbuild.yaml . **** ERROR HERE ****
gcloud container images list --filter ng
当我尝试提交新构建器时,我在初始化节点时遇到错误-sass。现在 GCC 对构建错误并不吝啬,但我将其浓缩在这里,因为我不认为它是所有相关的。
BUILD
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/docker
Step #0: Sending build context to Docker daemon 8.704kB
Step #0: Step 1/4 : FROM node:current
Step #0: current: Pulling from library/node
Step #0: Digest: sha256:a1118930ecc77da1ce4b19ac8c17adf386b7bb36b348111437f1cfca5a5c9fd7
Step #0: Status: Downloaded newer image for node:current
Step #0: ---> 9c23a8242f8b
Step #0: Step 2/4 : ARG ng_version=latest
Step #0: ---> Running in 8571f9c93b72
Step #0: Removing intermediate container 8571f9c93b72
Step #0: ---> ae862a663d5c
Step #0: Step 3/4 : RUN npm install -g @angular/cli@$ng_version --unsafe-perms && ng version
Step #0: ---> Running in 8b6eabc3c04e
...
...
lots of npm install deprecated warnings
...
...
Step #0: npm ERR! code 1
Step #0: npm ERR! path /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
Step #0: npm ERR! command failed
Step #0: npm ERR! command sh -c node scripts/build.js
Step #0: npm ERR! Building: /usr/local/bin/node /usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
Step #0: npm ERR! make: Entering directory '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/build'
Step #0: npm ERR! g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/root/.node-gyp/16.10.0/include/node -I/root/.node-gyp/16.10.0/src -I/root/.node-gyp/16.10.0/deps/openssl/config -I/root/.node-gyp/16.10.0/deps/openssl/openssl/include -I/root/.node-gyp/16.10.0/deps/uv/include -I/root/.node-gyp/16.10.0/deps/zlib -I/root/.node-gyp/16.10.0/deps/v8/include -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
...
...
a lot more GCC make errors
...
...
Step #0: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
Step #0: npm ERR! gyp ERR! build error
Step #0: npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
Step #0: npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/lib/build.js:262:23)
Step #0: npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
Step #0: npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
Step #0: npm ERR! gyp ERR! System Linux 5.4.0-1052-gcp
Step #0: npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
Step #0: npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
Step #0: npm ERR! gyp ERR! node -v v16.10.0
Step #0: npm ERR! gyp ERR! node-gyp -v v3.8.0
Step #0: npm ERR! gyp ERR! not ok
Step #0: npm ERR! Build failed with error code: 1
Step #0:
Step #0: npm ERR! A complete log of this run can be found in:
Step #0: npm ERR! /root/.npm/_logs/2021-10-05T13_37_53_770Z-debug.log
Step #0: The command '/bin/sh -c npm install -g @angular/cli@$ng_version --unsafe-perms && ng version' returned a non-zero code: 1
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
Step #0:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build c9c6d17a-e87f-449a-9901-44b786e8dd39 completed with status "FAILURE"
我是 angular 的新手,也是云构建的新手,所以不确定下一步该从哪里开始。如果我不得不猜测预配置的构建映像在节点版本和 node-sass 版本之间不兼容——至少这是我过去在本地看到的导致此类问题的原因。但由于它是远程图像,我觉得它应该处于已知的良好状态。
发布@anon58192932 可见性解决方案:
您可以关注使用通用 npm
图片的 Medium guide。
cloudbuild.yaml
:
steps:
# Install node packages
- name: 'gcr.io/cloud-builders/npm'
args: [ 'install' ]
# Build productive files
- name: 'gcr.io/cloud-builders/npm'
args: [ 'run', 'build', '--prod' ]
# Deploy to google cloud app egnine
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', '--version=prod']
到目前为止我完成的步骤:
- 我创建了一个
Google Cloud Repository
- 我创建了一个
Cloud Build Trigger
并将其链接到我的 GitHub 帐户和存储库,并与分支名称完全匹配^staging$
现在根据 the guide 我正在尝试使用以下代码初始化 angular 生成器:
git clone https://github.com/GoogleCloudPlatform/cloud-builders-community
cd cloud-builders-community/ng
gcloud builds submit --config cloudbuild.yaml . **** ERROR HERE ****
gcloud container images list --filter ng
当我尝试提交新构建器时,我在初始化节点时遇到错误-sass。现在 GCC 对构建错误并不吝啬,但我将其浓缩在这里,因为我不认为它是所有相关的。
BUILD
Starting Step #0
Step #0: Already have image (with digest): gcr.io/cloud-builders/docker
Step #0: Sending build context to Docker daemon 8.704kB
Step #0: Step 1/4 : FROM node:current
Step #0: current: Pulling from library/node
Step #0: Digest: sha256:a1118930ecc77da1ce4b19ac8c17adf386b7bb36b348111437f1cfca5a5c9fd7
Step #0: Status: Downloaded newer image for node:current
Step #0: ---> 9c23a8242f8b
Step #0: Step 2/4 : ARG ng_version=latest
Step #0: ---> Running in 8571f9c93b72
Step #0: Removing intermediate container 8571f9c93b72
Step #0: ---> ae862a663d5c
Step #0: Step 3/4 : RUN npm install -g @angular/cli@$ng_version --unsafe-perms && ng version
Step #0: ---> Running in 8b6eabc3c04e
...
...
lots of npm install deprecated warnings
...
...
Step #0: npm ERR! code 1
Step #0: npm ERR! path /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
Step #0: npm ERR! command failed
Step #0: npm ERR! command sh -c node scripts/build.js
Step #0: npm ERR! Building: /usr/local/bin/node /usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
Step #0: npm ERR! make: Entering directory '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/build'
Step #0: npm ERR! g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/root/.node-gyp/16.10.0/include/node -I/root/.node-gyp/16.10.0/src -I/root/.node-gyp/16.10.0/deps/openssl/config -I/root/.node-gyp/16.10.0/deps/openssl/openssl/include -I/root/.node-gyp/16.10.0/deps/uv/include -I/root/.node-gyp/16.10.0/deps/zlib -I/root/.node-gyp/16.10.0/deps/v8/include -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
...
...
a lot more GCC make errors
...
...
Step #0: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
Step #0: npm ERR! gyp ERR! build error
Step #0: npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
Step #0: npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/lib/build.js:262:23)
Step #0: npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
Step #0: npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
Step #0: npm ERR! gyp ERR! System Linux 5.4.0-1052-gcp
Step #0: npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
Step #0: npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
Step #0: npm ERR! gyp ERR! node -v v16.10.0
Step #0: npm ERR! gyp ERR! node-gyp -v v3.8.0
Step #0: npm ERR! gyp ERR! not ok
Step #0: npm ERR! Build failed with error code: 1
Step #0:
Step #0: npm ERR! A complete log of this run can be found in:
Step #0: npm ERR! /root/.npm/_logs/2021-10-05T13_37_53_770Z-debug.log
Step #0: The command '/bin/sh -c npm install -g @angular/cli@$ng_version --unsafe-perms && ng version' returned a non-zero code: 1
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
Step #0:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build c9c6d17a-e87f-449a-9901-44b786e8dd39 completed with status "FAILURE"
我是 angular 的新手,也是云构建的新手,所以不确定下一步该从哪里开始。如果我不得不猜测预配置的构建映像在节点版本和 node-sass 版本之间不兼容——至少这是我过去在本地看到的导致此类问题的原因。但由于它是远程图像,我觉得它应该处于已知的良好状态。
发布@anon58192932 可见性解决方案:
您可以关注使用通用 npm
图片的 Medium guide。
cloudbuild.yaml
:steps: # Install node packages - name: 'gcr.io/cloud-builders/npm' args: [ 'install' ] # Build productive files - name: 'gcr.io/cloud-builders/npm' args: [ 'run', 'build', '--prod' ] # Deploy to google cloud app egnine - name: 'gcr.io/cloud-builders/gcloud' args: ['app', 'deploy', '--version=prod']