You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently exploring possibilities for node SEA apps
Is it possible to access npm cli commands from my custom binary (or bundle the npm cli together with my sea app)
E.g. a user downloads the custom binary my_bin
then invokes my_bin setup . to setup a project in the current directory
which internally will call the equivalent to npm install
Alternatively I'd be curious to hear what the best solution would be for such a case without reinventing the wheel
I tried bundling my app with npm as a dependency and calling the npm commands programmatically but this results in error: The programmatic API was removed in npm v8.0.0
The idea was to bundle custom code that already exists as a node cli package with the node runtime - one of the usecases for the cli we have is to manage/install/build npm packages so we need to run npm commands (or invoke the same functionality ideally in another way).
Alternatively we could probably ship nodejs next to the cli tool - but we want to avoid requiring additional dependencies from users and control the installed node version.
Activity
[-]Execute `npm install` with SEA[/-][+]Execute `npm` cli commands with SEA[/+]marwie commentedon Jan 27, 2025
I tried bundling my app with npm as a dependency and calling the npm commands programmatically but this results in
error: The programmatic API was removed in npm v8.0.0marwie commentedon Feb 10, 2025
Related to #100
GabenGar commentedon Feb 11, 2025
Why do you need
npm installon an executable in the first place?marwie commentedon Feb 11, 2025
The idea was to bundle custom code that already exists as a node cli package with the node runtime - one of the usecases for the cli we have is to manage/install/build npm packages so we need to run npm commands (or invoke the same functionality ideally in another way).
Alternatively we could probably ship nodejs next to the cli tool - but we want to avoid requiring additional dependencies from users and control the installed node version.
cspotcode commentedon Feb 11, 2025
I've had success doing this with
yarn: bundlingyarnand calling it programmatically.I bet other alternative package managers would work, too.
marwie commentedon Feb 11, 2025
Interesting, thanks for the heads up! I will test that!