Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sschmidTU opened this issue Nov 27, 2021 · 7 comments

Comments

@sschmidTU
Copy link

sschmidTU commented Nov 27, 2021

  • 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:
rvilarl/opensheetmusicdisplay@df20f00

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>)
@rvilarl
Copy link

rvilarl commented Dec 7, 2021

@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.

@codymikol
Copy link
Owner

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.

@sschmidTU
Copy link
Author

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.

@Hinton
Copy link

Hinton commented Dec 17, 2021

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?

@Macinto5h
Copy link

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

@codymikol
Copy link
Owner

Nope

@codymikol
Copy link
Owner

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

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

No branches or pull requests

5 participants