Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Possible to build with --inspect or --inspect-brk option? #93

Closed
nozzlegear opened this issue May 11, 2017 · 8 comments
Closed

Possible to build with --inspect or --inspect-brk option? #93

nozzlegear opened this issue May 11, 2017 · 8 comments
Labels

Comments

@nozzlegear
Copy link

Hey! I'm really enjoying using pkg both in production and playing around with it in some personal projects. I'm trying to debug one of these projects on a production server, but it looks like running ./executable-name --inspect-brk doesn't pass the --inspect-brk option to Node. I've tried baking it in with pkg package.json --options inspect-brk too, but that throws the following error:

/home/nozzlegear/.pkg-cache/v1.9/fetched-v7.6.0-linux-x64: bad option: --inspect-brk
> Error! Error: Was not able to compile for '{"nodeRange":"node7","platform":"linux","arch":"x64","output":"alexa-skills-linux","forceBuild":false,"fabricator":{"nodeRange":"node7","platform":"linux","arch":"x6
4","forceBuild":false,"binaryPath":"/home/nozzlegear/.pkg-cache/v1.9/fetched-v7.6.0-linux-x64"},"binaryPath":"/home/nozzlegear/.pkg-cache/v1.9/fetched-v7.6.0-linux-x64","slash":"/"}'
    at Socket.<anonymous> (/mnt/d/source/alexa-skills/node_modules/pkg/lib-es5/producer.js:46:25)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at onwriteError (_stream_writable.js:341:10)
    at onwrite (_stream_writable.js:359:5)
    at fireErrorCallbacks (net.js:483:13)
    at Socket._destroy (net.js:524:3)
    at WriteWrap.afterWrite [as oncomplete] (net.js:818:10)
error Command failed with exit code 2.

Is it possible to use --inspect-brk in any way? In ideal conditions I shouldn't have to be debugging an app in production, but sometimes conditions aren't ideal. 🙃

@igorklopov
Copy link
Contributor

  1. Delete ~/.pkg-cache directory
  2. Install pkg locally (not globally)
  3. Edit 'pkg/node_modules/pkg-fetch/patches/node.v7.6.0.patch'
  4. Remove 'node/src/node.cc' hunk (it removes code for debugging options)
  5. Run local pkg with options -t host -b pointing to your application
  6. Wait customised node.js to be compiled

@nozzlegear
Copy link
Author

Thanks for the guidance, this worked!

For anyone reading this in the future, I had to switch over to Linux to build Node; the build process would just get stuck on Windows, even when using WSL. The first build took about 25 minutes to complete on an i7 with 16gb ram, but after that it was able to reuse the previously built Node.

@opowell
Copy link

opowell commented Jun 11, 2018

I am writing an application that allows users to write their own JS "apps" that are interpreted on the server (https://github.com/opowell/jtree). It would be ideal if they could use "debugger" statements in their code.

So.. I would be most pleased if this was added to a future release. (I will be using the workaround in the meantime).

@opowell opowell mentioned this issue Sep 13, 2018
@zcubes
Copy link

zcubes commented Sep 15, 2018

pkg baking with --inspect or --inspect-brk did not seem to work as expected. Would be wonderful if this can be done to assist debugger trigger for languages converted to js (like coffeescript etc.).

pkg is excellent!

@luziat
Copy link

luziat commented Oct 29, 2018

I can't build customised node.js with next error

Error! Error: spawn patch ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

After downloading from git, it occurs at the 'applying patches' step.
I'm working on windows 7.
How can i fix it?

@billtlee
Copy link

Screen Shot 2020-12-11 at 3 27 39 PM
Hi,
So, is this what I am removing? Which file(s) should I remove it from?
Thanks!

@hughobrien
Copy link

hughobrien commented Jun 26, 2021

Error! Error: spawn patch ENOENT

apt install patch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants