Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Add an example that skips node-gyp installs #178

Open
1 task
Aghassi opened this issue Jan 30, 2023 · 2 comments
Open
1 task

[FR]: Add an example that skips node-gyp installs #178

Aghassi opened this issue Jan 30, 2023 · 2 comments
Labels
example New example or update to existing example

Comments

@Aghassi
Copy link

Aghassi commented Jan 30, 2023

What is the current behavior?

Post install hooks can fail with pnpm. One that I ran into was

❯ bazel test //bazel/release/internal/pusher:test
INFO: Invocation ID: f430ce78-99c5-461c-84f5-b135bd3fc6e5
INFO: Analyzed target //bazel/release/internal/pusher:test (2296 packages loaded, 35938 targets configured).
INFO: Found 1 test target...
ERROR: /Users/davidaghassi/robinhood/rh_other_alt/bazel/release/internal/pusher/BUILD.bazel:9:22: Running lifecycle hooks on npm package [email protected] failed: (Exit 1): lifecycle-hooks.sh failed: error executing command (from target //bazel/release/internal/pusher:.aspect_rules_js/node_modules/[email protected]/lc) bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh cpu-features ../../../external/pusher_pnpm_deps__cpu-features__0.0.4/package ... (remaining 1 argument skipped)
/private/var/tmp/_bazel_davidaghassi/299af5c32fa95b8ba15b1237ac8646db/execroot/rh/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/node-gyp-bin/node-gyp: line 5: 1211: command not found

> [email protected] install /private/var/tmp/_bazel_davidaghassi/299af5c32fa95b8ba15b1237ac8646db/execroot/rh/bazel-out/darwin_arm64-fastbuild/bin/bazel/release/internal/pusher/node_modules/.aspect_rules_js/[email protected]/node_modules/cpu-features
> node buildcheck.js > buildcheck.gypi && node-gyp rebuild

===============================================================
Failure while running lifecycle hook for package '[email protected]':

  Script:  'install'
  Command: `node buildcheck.js > buildcheck.gypi && node-gyp rebuild`

Stack trace:

spawn ENOENT
    at ChildProcess.<anonymous> (/private/var/tmp/_bazel_davidaghassi/299af5c32fa95b8ba15b1237ac8646db/execroot/rh/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/index.min.js:1:91930)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
===============================================================

having docs/example/suggestion on how to solve this would make error handling better.

Describe the feature

Adding this fix pnpm/pnpm#4347 (comment) to my package.json resolved my issue and let me continue building/testing.

The reason this is hard to troubleshoot is because outside of bazel, running pnpm i works fine.

Fund our work

@Aghassi Aghassi added the enhancement New feature or request label Jan 30, 2023
@gregmagolan gregmagolan moved this to 📋 Backlog in Open Source Feb 7, 2023
@gregmagolan gregmagolan moved this from 📋 Backlog to 🔖 Ready in Open Source Feb 7, 2023
@gregmagolan gregmagolan added example New example or update to existing example and removed enhancement New feature or request labels Feb 7, 2023
@twheys
Copy link

twheys commented Mar 16, 2023

I get a similar issue when trying to build the angular app

➜  bazel build //:app 
INFO: Analyzed target //:app (889 packages loaded, 7588 targets configured).
INFO: Found 1 target...
ERROR: /Users/theys/github/aspect-build/bazel-examples/angular/BUILD.bazel:7:22: Running lifecycle hooks on npm package [email protected] failed: (Exit 1): lifecycle-hooks.sh failed: error executing command (from target //:.aspect_rules_js/node_modules/[email protected]/lc) bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh nice-napi ../../../external/npm__nice-napi__1.0.2/package ... (remaining 1 argument skipped)
/private/var/tmp/_bazel_theys/676332011c2f3e295756330f3b91b35c/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/node-gyp-bin/node-gyp: line 5: 1211: command not found

> [email protected] install /private/var/tmp/_bazel_theys/676332011c2f3e295756330f3b91b35c/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/nice-napi
> node-gyp-build

===============================================================
Failure while running lifecycle hook for package '[email protected]':

  Script:  'install'
  Command: `node-gyp-build`

Stack trace:

spawn ENOENT
    at ChildProcess.<anonymous> (/private/var/tmp/_bazel_theys/676332011c2f3e295756330f3b91b35c/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/index.min.js:1:91930)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
===============================================================
Target //:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 37.890s, Critical Path: 4.58s
INFO: 2783 processes: 1848 internal, 3 darwin-sandbox, 932 local.

@mtsgrd
Copy link

mtsgrd commented Dec 25, 2023

I also get a similar issue, but can't seem to get @Aghassi workaround to work.

bazel build //:app
INFO: Analyzed target //:app (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/mattias/c/bazel-examples/angular/BUILD.bazel:7:22: Running lifecycle hooks on npm package [email protected] failed: (Exit 1): lifecycle-hooks.sh failed: error executing command (from target //:.aspect_rules_js/node_modules/[email protected]/lc) bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh nice-napi ../../../external/npm__nice-napi__1.0.2/package ... (remaining 1 argument skipped)
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '/private/var/tmp/_bazel_mattias/3027eccc8676ed26bace85ab5cf2a721/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/node_modules/node-gyp/bin/node-gyp.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

> [email protected] install /private/var/tmp/_bazel_mattias/3027eccc8676ed26bace85ab5cf2a721/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/nice-napi
> node-gyp-build

===============================================================
Failure while running lifecycle hook for package '[email protected]':

  Script:  'install'
  Command: `node-gyp-build`

Stack trace:

Exit status 1
    at EventEmitter.<anonymous> (/private/var/tmp/_bazel_mattias/3027eccc8676ed26bace85ab5cf2a721/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:513:28)
    at ChildProcess.<anonymous> (/private/var/tmp/_bazel_mattias/3027eccc8676ed26bace85ab5cf2a721/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:513:28)
    at maybeClose (node:internal/child_process:1100:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
===============================================================
Target //:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.496s, Critical Path: 0.34s
INFO: 3 processes: 2 internal, 1 local.
FAILED: Build did NOT complete successfully
Error: bazel exited with exit code: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example New example or update to existing example
Projects
Status: On Deck
Development

No branches or pull requests

4 participants