JoshMarler/react-juce

Dynamic import can only be transformed when transforming ES modules to AMD, CommonJS or SystemJS. node:internal/crypto/hash:69

SeamusMullan opened this issue · 2 comments

I got this issue after running npm start on a new react-juce project. unsure what has happened but below is a full copypasta of what was done.

(base) PS B:\DirektDSP\react-juce\packages\react-juce> npm run init -- "C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui"

> react-juce@0.2.16 init
> node scripts/init.js C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui

Initializing a React-JUCE template in: C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui
Directory tree will be created if it does not exist.
[*] Copying template files
[*] Installing dependencies


Success! Initialized a React-JUCE template in C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui

You can now get started by typing:

cd C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui
npm start

Then adding the reactjuce::ReactApplicationRoot component to your project.

(base) PS B:\DirektDSP\react-juce\packages\react-juce> cd "C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui"
(base) PS C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui> npm start

> ui@0.1.0 start
> webpack -w --mode=development


webpack is watching the files…

Dynamic import can only be transformed when transforming ES modules to AMD, CommonJS or SystemJS.
node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at context.callback (C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Users\seamu\OneDrive\Direkt Software\FXBox\Source\jsui\node_modules\babel-loader\lib\index.js:44:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.17.0

I'm also having the same issue performing the same steps, we managed to fix it for the GainPlugin by

echo "export NODE_OPTIONS=--openssl-legacy-provider" > ~/.bash_profile

But for the template generator I get the same errors

I'm also having the same issue performing the same steps, we managed to fix it for the GainPlugin by

echo "export NODE_OPTIONS=--openssl-legacy-provider" > ~/.bash_profile

But for the template generator I get the same errors

Be aware that:

  1. You need to source the profile file (either bash or for zsh, depending on the shell you're using).
  2. For me, once this option was added, I started to face problems to open VSCode from CLI, so I manually set NODE_OPTIONS="" before run vscode on CLI.

My point is that you might face some drawbacks for other node-based apps you might use and you can solve it by assigning an empty value to this variable in case it happens.