挂接网络包错误:在节点容器中运行npm生成时,服务不再运行

gfttwv5a  于 2023-02-04  发布在  其他
关注(0)|答案(1)|浏览(172)

在gitlab-ci作业中,在Kubernetes上的容器中运行npm run build时会发生这种情况。请注意,npm install、npm run lint和npm run test都运行正常。
错误:

node@runner-7gbsh-sz-project-9665-concurrent-0c6cv4:~/app$ npm run build -- --output-path=dist

> bluefin-ui@0.0.0 build
> ng build --output-path=dist

Node.js version v19.3.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
- Generating browser application bundles (phase: setup)...
✔ Browser application bundle generation complete.
An unhandled exception occurred: The service is no longer running
See "/tmp/ng-88rVP9/angular-errors.log" for further details.
node@runner-7gbsh-sz-project-9665-concurrent-0c6cv4:~/app$ cat /tmp/ng-88rVP9/angular-errors.log
[error] HookWebpackError: The service is no longer running
    at makeWebpackError (/working/builds/app/node_modules/webpack/lib/HookWebpackError.js:48:9)
    at /working/builds/app/node_modules/webpack/lib/Compilation.js:3060:12
    at eval (eval at create (/working/builds/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:115:1)
-- inner error --
Error: The service is no longer running
    at /working/builds/app/node_modules/esbuild-wasm/lib/main.js:786:29
    at sendRequest (/working/builds/app/node_modules/esbuild-wasm/lib/main.js:661:14)
    at start (/working/builds/app/node_modules/esbuild-wasm/lib/main.js:784:9)
    at Object.transform2 [as transform] (/working/builds/app/node_modules/esbuild-wasm/lib/main.js:841:5)
    at /working/builds/app/node_modules/esbuild-wasm/lib/main.js:1928:55
    at new Promise (<anonymous>)
    at Object.transform (/working/builds/app/node_modules/esbuild-wasm/lib/main.js:1928:14)
    at EsbuildExecutor.transform [as esbuildTransform] (/working/builds/app/node_modules/esbuild-wasm/lib/main.js:1751:62)
    at EsbuildExecutor.transform (/working/builds/app/node_modules/@angular-devkit/build-angular/src/webpack/plugins/esbuild-executor.js:113:21)
    at async /working/builds/app/node_modules/@angular-devkit/build-angular/src/webpack/plugins/css-optimizer-plugin.js:70:53

图片:www.example.com版本信息(来自运行容器):docker.io/library/node:19.3.0-bullseye Version information (from within running container):

node@runner-7gbsh-sz-project-9665-concurrent-0xj5hz:~/app$ npm ls
bluefin-ui@0.0.0 /working/builds/app
+-- @angular-devkit/build-angular@15.0.4
+-- @angular-eslint/builder@15.1.0
+-- @angular-eslint/eslint-plugin-template@15.1.0
+-- @angular-eslint/eslint-plugin@15.1.0
+-- @angular-eslint/schematics@15.1.0
+-- @angular-eslint/template-parser@15.1.0
+-- @angular/animations@15.0.4
+-- @angular/cli@15.0.4
+-- @angular/common@15.0.4
+-- @angular/compiler-cli@15.0.4
+-- @angular/compiler@15.0.4
+-- @angular/core@15.0.4
+-- @angular/forms@15.0.4
+-- @angular/platform-browser-dynamic@15.0.4
+-- @angular/platform-browser@15.0.4
+-- @angular/router@15.0.4
+-- @types/jasmine@4.0.3
+-- @types/node@18.11.17
+-- @typescript-eslint/eslint-plugin@5.44.0
+-- @typescript-eslint/parser@5.44.0
+-- eslint@8.30.0
+-- jasmine-core@4.3.0
+-- karma-chrome-launcher@3.1.1
+-- karma-coverage@2.2.0
+-- karma-jasmine-html-reporter@2.0.0
+-- karma-jasmine@5.1.0
+-- karma@6.4.1
+-- node-addon-api@3.2.1 extraneous
+-- node-gyp-build@4.5.0 extraneous
+-- pify@4.0.1 extraneous
+-- rxjs@7.5.7
+-- tslib@2.4.1
+-- typescript@4.8.4
+-- yocto-queue@0.1.0 extraneous
`-- zone.js@0.11.8

node@runner-7gbsh-sz-project-9665-concurrent-0xj5hz:~/app$ npm version
{
  'bluefin-ui': '0.0.0',
  npm: '9.2.0',
  node: '19.3.0',
  v8: '10.8.168.21-node.8',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '111',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '8.1.0',
  uvwasi: '0.0.13',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022f',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}

容器以非根用户身份运行,UID = 1000。上面提到的/working/builds目录是可写的(node_modules位于此处)。
这与问题#22338类似(实际上相同),但运行环境不同。
期望命令成功运行,我尝试直接在容器中执行并验证行为。我一直在寻找信息,以建议寻找解决方案的方向,因为这是一个内部错误,我在这一点上缺乏线索。

f4t66c6m

f4t66c6m1#

似乎已通过npm 9.4.1(节点16.17.0)和更新Angular (CLI 15.1.4)解决。

相关问题