NPM Bazel error

14 views
Skip to first unread message

Steve Edson

unread,
Oct 17, 2024, 11:42:44 AMOct 17
to bazel-discuss
I have a package which was working fine, but as soon as I try to add a `cybersource-rest-client` page, I get the following error:

bazel run //project/graphql/payments-service:payments-service_bin --verbose_failures
Starting local Bazel server and connecting to it...
INFO: Analyzed target //project/graphql/payments-service:payments-service_bin (1004 packages loaded, 11464 targets configured).
ERROR: /Users/steve/repos/project_monorepo/BUILD.bazel:11:22: Running lifecycle hooks on npm package dea...@0.1.30 failed: (Exit 1): lifecycle-hooks.sh failed: error executing NpmLifecycleHook command (from target //:.aspect_rules_js/node_modules/dea...@0.1.30/lc)
  (cd /private/var/tmp/_bazel_steve/8e03484681e57aa7e51336201783e1aa/execroot/_main && \
  exec env - \
    BAZEL_BINDIR=bazel-out/darwin_arm64-fastbuild/bin \
    BAZEL_BUILD_FILE_PATH=BUILD.bazel \
    BAZEL_COMPILATION_MODE=fastbuild \
    BAZEL_PACKAGE='' \
    BAZEL_TARGET=//:.aspect_rules_js/node_modules/dea...@0.1.30/lc \
    BAZEL_TARGET_CPU=darwin_arm64 \
    BAZEL_TARGET_NAME=.aspect_rules_js/node_modules/dea...@0.1.30/lc \
    BAZEL_WORKSPACE=_main \
    JS_BINARY__PATCH_NODE_FS=1 \
    JS_BINARY__SILENT_ON_SUCCESS=1 \
    JS_BINARY__USE_EXECROOT_ENTRY_POINT=1 \
    PATH=/bin:/usr/bin:/usr/local/bin \
  bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/aspect_rules_js~/npm/private/lifecycle/lifecycle-hooks.sh deasync ../../../external/npm__deasync__0.1.30/package ../../../bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/dea...@0.1.30/node_modules/deasync '--platform=darwin' '--arch=arm64')
# Configuration: 25e79c100bbef97fc21ccae19cd85c5f72e89b48e018b5be28f1ce628492064d
# Execution platform: @@platforms//host:host
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/private/var/tmp/_bazel_steve/8e03484681e57aa7e51336201783e1aa/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js~/npm/private/lifecycle/node_modules/node-gyp/bin/node-gyp.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.14.0
Build failed

> dea...@0.1.30 install /private/var/tmp/_bazel_steve/8e03484681e57aa7e51336201783e1aa/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/dea...@0.1.30/node_modules/deasync
> node ./build.js

===============================================================
Failure while running lifecycle hook for package 'dea...@0.1.30':

  Script:  'install'
  Command: `node ./build.js`

Stack trace:

Exit status 1
    at EventEmitter.<anonymous> (/private/var/tmp/_bazel_steve/8e03484681e57aa7e51336201783e1aa/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js~/npm/private/lifecycle/min/index.min.js:47:92054)
    at EventEmitter.emit (node:events:519:28)
    at ChildProcess.<anonymous> (/private/var/tmp/_bazel_steve/8e03484681e57aa7e51336201783e1aa/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js~/npm/private/lifecycle/min/index.min.js:1:195024)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
===============================================================
INFO: Found 1 target...
Target //project/graphql/payments-service:payments-service_bin failed to build
INFO: Elapsed time: 11.185s, Critical Path: 0.83s
INFO: 12 processes: 6 internal, 1 darwin-sandbox, 5 local.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target


I've defined the dependencies in my package.json, installs fine via PNPM, updated the bazel build to include the dependencies. I've also tried adding:

"pnpm": { "packageExtensions": { "deasync": { "dependencies": { "node-gyp": "*" } } } }

as well as

lifecycle_hooks_exclude = [ "@parcel/watcher", "sharp", "tree-sitter", "tree-sitter-typescript", "@esbuild/sunos-x64", ],


With no luck
Reply all
Reply to author
Forward
0 new messages