-
Notifications
You must be signed in to change notification settings - Fork 1k
pkg executable runs differently on 4.4.9 and 4.5.1 #1130
Comments
@erossignon any clue? |
@stevenalbert, could you try running with /debug option on so we could compare the two logs. |
@erossignon Version 4.4.9: Version 4.5.1: |
@stevenalbert , thank you, the debug output are identical .. My guess is that the issue is not in the walker , but in the bootstrap. I also spotted that the file starts with "D:" on both examples. Do you have the same issue if you run on the C:\ drive instead ? |
@erossignon Yes, I just tried to build and run on C:\ drive, the issue still exists. |
Hello! I've put together a simple reproduction of the problem at https://github.com/dominics/bug-pkg-globby - it's a small three-line script, but submitting a repo lets you build it, play around with it, and I can happily provide binaries if anyone can't build it. The reproduction script is just: const globby = require('globby')
const results = globby.sync(['**/*.js'], { cwd: '/snapshot' })
console.log('Contents of /snapshot: ', results) This prints hundreds of matches when built under 4.4.9, and zero matches when built under 4.5.0 (or 5.1.0 for that matter), even when the snapshot contents are identical. From this reproduction repo, I've learned:
Note: trying to use 4.4.9 seems to run into the pkg-fetch related recommendation to upgrade to 5.x, which is pretty annoying when combined with this regression! The reproduction repo uses yarn resolutions as a workaround. |
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
This is still valid and relevant, bot. |
FWIW, I upgraded pkg from 4.4.9 to 5.3.1 and unfortunately, my app.exe no longer runs. Prior to finding this open issue, I traced it down to the fact that my code crawls through a directory within the snapshot: i.e.: via:
This call fails immediately with the message: "ENOENT, no such file or directory, scandir..." (The message includes the exact directory that is included in the snapshot -- I've confirmed it via --debug). So, it's definitely a problem with the patching of readdirsync, reader as @dominics pointed out above. |
My pkg compiled app had been working 'swimmingly' for years. As described above, I upgraded from 4.4.9 to latest and it breaks on a readdirSync. Unfortunately, if you perform this upgrade, you cannot REVERT back primarily because you'll end up deleting your cached pkg-fetch based binaries and when you `npm install pkg@4.4.9', you'll quickly discover why your screwed: For this older version, it's pkg-fetch attempts to retrieve from an old 'zest' location that no longer exists. Ugh.!!! In any event, being forced to figure out a way forward, the described issue involves the following: Within pkg's bootstrap.js it hijacks node's fs.readdirsync with a replacement that handles the fs.readdirsync option named 'withFileTypes' incorrectly. In particular, the statement (currently v5.3.1) line 1148:
should be changed to:
And... That's the fix. |
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
Commenting to avoid close. Not stale, PR open. |
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit. |
Overview minimum project:
Issue:
Create executable on windows with version
4.5.1
gives different result than version4.4.9
.On version
4.4.9
, executables resulted 3 routes (1 explicitly imported and 2 is added from controllers directory).On version
4.5.1
, executables resulted 1 routes (1 explicitly imported only), whereas 2 from controllers directory is not generated.After looking for a while, it's like controllers not read on version 4.5.1.
I tested on version
4.5.0
too with the result same as4.5.1
I try to debug the difference, and I added line on
node_modules\@tsed\di\lib\utils\importFiles.js
and the log can be seen on logs below:Project directory:
package.json
:Using version
4.4.9
, I can get 3 routes:Using version
4.5.1
, I can only get 1 route which is explicitly imported:The text was updated successfully, but these errors were encountered: