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

[NodeJS 17 or later] “npm run dev”, “npm start”, and “npm run deploy” throw exception #4861

Closed
esperecyan opened this issue Nov 26, 2021 · 7 comments
Labels
bug jira-hubs needs triage For bugs that have not yet been assigned a fix priority

Comments

@esperecyan
Copy link

esperecyan commented Nov 26, 2021

Description
When I run npm run deploy on NodeJS17, it throws an exception.

To Reproduce
Steps to reproduce the behavior:

  1. Install NodeJS 17
  2. Clone https://github.com/mozilla/hubs
  3. git checkout hubs-cloud (52f293e)
  4. npm ci
  5. npm run login
  6. npm run deploy
  7. See error

PS ○○○○○○\hubs> npm run deploy

> hubs@0.0.1 deploy
> node -r @babel/register -r esm -r ./scripts/shim scripts/deploy.js

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Deploying to exr-hubs.com.
  / Building Client.node:child_process:397
      ex = new Error('Command failed: ' + cmd + '\n' + stderr);
           ^

Error: Command failed: npm run build
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (○○○○○○\hubs\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (○○○○○○\hubs\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (○○○○○○\hubs\node_modules\webpack\lib\NormalModule.js:471:10)
    at ○○○○○○\hubs\node_modules\webpack\lib\NormalModule.js:503:5
    at ○○○○○○\hubs\node_modules\webpack\lib\NormalModule.js:358:12
    at ○○○○○○\hubs\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (○○○○○○\hubs\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (○○○○○○\hubs\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at ○○○○○○\hubs\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at context.callback (○○○○○○\hubs\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at ○○○○○○\hubs\node_modules\babel-loader\lib\index.js:51:71
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.1.0

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1062:16)
    at Socket. (node:internal/child_process:448:11)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at Pipe. (node:net:687:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'npm run build'
}

Node.js v17.1.0

Expected behavior
Deployment is completed successfully.

Hardware

  • Device: Desktop
  • OS: Windows 10
  • Browser: Firefox

Additional context
I uninstalled NodeJS 17 and installed NodeJS 16, and the deployment completed successfully.

This may be caused by depending on an older version of webpack.
webpack/webpack#14532

┆Issue is synchronized with this Jira Task

@esperecyan esperecyan added bug jira-hubs needs triage For bugs that have not yet been assigned a fix priority labels Nov 26, 2021
@esperecyan
Copy link
Author

https://github.com/mozilla/hubs/blob/52f293ed7f65329386adc50cbd192807166c83a5/scripts/deploy.js#L44-L49
I was able to work around this problem by inserting buildEnv.NODE_OPTIONS = "--openssl-legacy-provider"; into scripts/deploy.js.

  buildEnv.BUILD_VERSION = `1.0.0.${version}`;
  buildEnv.ITA_SERVER = "";
  buildEnv.POSTGREST_SERVER = "";
  buildEnv.CONFIGURABLE_SERVICES = "janus-gateway,reticulum,hubs,spoke";
  // Workaround for npm run deploy failing on NodeJS 17
  // https://github.com/mozilla/hubs/issues/4861
  buildEnv.NODE_OPTIONS = "--openssl-legacy-provider";

  const env = Object.assign(process.env, buildEnv);

@esperecyan
Copy link
Author

This problem also occurred with npm run dev, and similarly, I was able to work around it by setting the environment variable NODE_OPTIONS to --openssl-legacy-provider.

@esperecyan esperecyan changed the title [NodeJS 17] “npm run deploy” throws exception [NodeJS 17] “npm run dev” and “npm run deploy” throw exception Dec 17, 2021
@msalafia
Copy link

Where should i define NODE_OPTIONS = "--openssl-legacy-provider" for npm run start?

@esperecyan
Copy link
Author

@msalafia I wrote a script file that calls webpack-dev-server in the spawn() function to inject the environment variable.

@techcto
Copy link

techcto commented May 28, 2022

I getting this $ npm install --legacy-peer-deps npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'aframe@1.0.3', npm WARN EBADENGINE required: { node: '>= 4.6.0', npm: '^2.15.9' }, npm WARN EBADENGINE current: { node: 'v16.14.2', npm: '8.5.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'networked-aframe@0.6.1', npm WARN EBADENGINE required: { node: '>= 7.4.0', npm: '^4.0.5' }, npm WARN EBADENGINE current: { node: 'v16.14.2', npm: '8.5.0' } npm WARN EBADENGINE } npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

@techcto
Copy link

techcto commented May 28, 2022

I am guessing these two sub repos need to be updated? Any advice to building locally?

https://github.com/MozillaReality/aframe
https://github.com/MozillaReality/networked-aframe

Is anyone working on these two repos?

@esperecyan esperecyan changed the title [NodeJS 17] “npm run dev” and “npm run deploy” throw exception [NodeJS 17 or later] “npm run dev”, “npm start”, and “npm run deploy” throw exception Jul 7, 2022
@netpro2k
Copy link
Contributor

netpro2k commented Aug 3, 2022

This should now be fixed with #5619 as we are now using node 16.16.0

@netpro2k netpro2k closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug jira-hubs needs triage For bugs that have not yet been assigned a fix priority
Projects
None yet
Development

No branches or pull requests

4 participants