yao-pkg / pkg

Package your Node.js project into an executable
https://www.npmjs.com/package/@yao-pkg/pkg
MIT License
312 stars 11 forks source link

Cannot find module * #45

Closed Avivbens closed 5 months ago

Avivbens commented 5 months ago

What version of pkg are you using?

5.11.5

What version of Node.js are you using?

20

What operating system are you using?

macOS

What CPU architecture are you using?

Apple M1

What Node versions, OSs and CPU architectures are you building for?

node20-macos-x64

Describe the Bug

Details

I'm using the pkg package to convert my NodeJS CLI application into a binary.

The Issue

Lately, I'm having issues with that. When running my node binary application via MacOS terminal, without arguments - everything works just fine. Once I add some commands to it, I get the following error: Error: Cannot find module '*//'

The weird thing is that over other terminals, such as Warp, I do not get this error at all.

Examples

Warp - does not happen

CleanShot 2024-04-03 at 01 51 57@2x

MacOS Native Terminal - does happen

Without Arguments

CleanShot 2024-04-03 at 01 51 23@2x

With Arguments

CleanShot 2024-04-03 at 01 51 31@2x

Expected Behavior

Should not get this error across all terminals, no matter which one I'm using.

See that the error indicates that it trying to find a module which is the command itself.

To Reproduce

I think the easiest way to reproduce that would be through my CLI, which is open-source.

Here is the link to the repo

To get it:

cd <YOUR_WORKING_DIR>
git clone https://github.com/Avivbens/shell-config.git
cd shell-config 
npm i --legacy-peer-deps
npm run pack-local
cd executable

./shell-config install
Avivbens commented 5 months ago

Resolved

For reference only - after FORCE QUIT the native terminal app - seems to be fixed