karma-webpack icon indicating copy to clipboard operation
karma-webpack copied to clipboard

5.0 crashes on MacOS (Preprocessor, Plugin), fixed on master -> Release 5.1?

Open sschmidTU opened this issue 3 years ago • 9 comments

  • Operating System: MacOS Catalina 10.15.7
  • Node Version: 16.13.0
  • NPM Version: 8.1.0
  • webpack Version: 5.64.4
  • karma-webpack Version: 5.0

Expected Behavior

Karma-webpack doesn't crash on MacOS

Actual Behavior

Karma-webpack 5.0 throws errors and crashes on MacOS, in karma-webpack/preprocessor.js and webpack/plugin.js. Both these errors are fixed on master, but not released yet, so you'd have to patch your npm release manually to make it work on MacOS.

If you're not ready to release 5.1 yet, instead releasing an alpha/dev version on npm with the current master would be great. Otherwise, I would have to create a prebuild script that patches in these 2 files from the master version into the node_modules/karma-webpack folders. Since I migrated to webpack 5, I also can't use karma-webpack 4.x for now, as far as I'm aware.


You can also fix these files in 5.0 with oneliners:

In node_modules/karma-webpack/lib/karma-webpack/preprocessor.js, I had to replace line 96 with this: return bundleContent;

And in node_modules/karma-webpack/lib/webpack/plugin.js, I had to replace line 18 with this: webpackFileObj.name.replace("../", "../../") There is a ../ missing from the path to make it valid, the chain of ../ stops one folder before the root node/folder.

How Do We Reproduce?

Probably just have a preprocessor file with 5.0 on MacOS.

Full repro: Check out this branch: https://github.com/rvilarl/opensheetmusicdisplay/tree/npm-upgrade Specifically this commit: https://github.com/rvilarl/opensheetmusicdisplay/commit/df20f00a9176c6821d19a05491908267687dd28a

Run npm install and npm test, which will crash.

ERROR [karma-server]: Error during file loading or preprocessing
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Hash.update (internal/crypto/hash.js:82:11)
    at Object.sha1 (/Users/simon/OSMD/opensheetmusicdisplay-working-copy/node_modules/karma/lib/utils/crypto-utils.js:9:8)
    at runProcessors (/Users/simon/OSMD/opensheetmusicdisplay-working-copy/node_modules/karma/lib/preprocessor.js:70:26)
ERROR [karma-server]: UnhandledRejection: Error: ENOENT: no such file or directory, open '/var/folders/zn/tspvl1cj6d305kvg4r8c894c0000gp/T/_karma_webpack_341844/../../../../../../Users/simon/OSMD/opensheetmusicdisplay-working-copy/dist/src/MusicalScore/Graphical/MusicSheetCalculator.d.ts'
    at Object.openSync (fs.js:458:3)
    at Object.readFileSync (fs.js:360:35)
    at /Users/simon/OSMD/opensheetmusicdisplay-working-copy/node_modules/karma-webpack/lib/webpack/plugin.js:20:66
    at Array.forEach (<anonymous>)

sschmidTU avatar Nov 27 '21 17:11 sschmidTU

@ryanclark @codymikol when it is planned to make the next release? The problems we have in OSMD are already resolved in the current code base.

rvilarl avatar Dec 07 '21 22:12 rvilarl

I know Ryan's been pretty occupied with his own obligations. When he has some time, I'm hoping to get our process for cutting releases streamlined so that we can quickly and easily cut new versions.

codymikol avatar Dec 08 '21 03:12 codymikol

By the way, paths are still broken for Windows with the current master build: Error: EINVAL: invalid argument, mkdir 'C:\Users\Simon\AppData\Local\Temp\_karma_webpack_82360\D:\code\osmd\opensheetmusicdisplay\dist\src'

Maybe something like PR #433 is still needed, even though the statement was made that relative paths were supposed to be eliminated.

sschmidTU avatar Dec 16 '21 18:12 sschmidTU

We've also experienced this issue while trying to bump webpack to v5 for our test suite, anything we can assist with to get a new release cut?

Hinton avatar Dec 17 '21 12:12 Hinton

Any update on a release that has the fix for this issue?

Macinto5h avatar Sep 28 '23 12:09 Macinto5h

Nope

codymikol avatar Sep 28 '23 19:09 codymikol

The repository was transferred to me, I'm preparing to make a 6.0.0 release that targets node 18+

codymikol avatar Oct 22 '23 00:10 codymikol