bazelbuild / examples

Examples for Bazel
http://bazel.build
Apache License 2.0
824 stars 506 forks source link

Next.js example uses invalid path to next binary for dev and start targets #323

Closed josephglanville closed 1 year ago

josephglanville commented 1 year ago

Running the example fails with the following error:

INFO: Invocation ID: 9b4af645-d270-41c8-ac65-0c87f5be876c
INFO: Analyzed target //next.js:next_dev (2 packages loaded, 85 targets configured).
INFO: Found 1 target...
Target //next.js:next_dev up-to-date:
  bazel-bin/next.js/next_dev.sh
INFO: Elapsed time: 0.255s, Critical Path: 0.06s
INFO: 29 processes: 4 internal, 25 local.
INFO: Build completed successfully, 29 total actions
INFO: Running command line: bazel-bin/next.js/next_dev.sh dev

Starting js_run_devserver //next.js:next_dev
Syncing...
18 files synced in 4 ms
Running '../../node_modules/.bin/next dev' in /tmp/js_run_devserver-zqIpYs/_main/next.js

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn ../../node_modules/.bin/next ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ../../node_modules/.bin/next',
  path: '../../node_modules/.bin/next',
  spawnargs: [ 'dev' ]
}

This can be fixed by changing the path in the call to the next macro to ./node_modules/next/dist/bin/next but I don't know if this is the correct fix.

alexeagle commented 1 year ago

Thanks, yeah I just overlooked this manual testing when moving to this repo. Want to send a PR?