datenanfragen / website

The Datenanfragen.de website including the request PDF generator and company information database
https://www.datenanfragen.de
MIT License
88 stars 126 forks source link

Running deploy script fails on node version 18.16.0 #1076

Closed davenewham closed 6 months ago

davenewham commented 1 year ago

I reverted to using Node 14 to get the deploy script to complete

Fetching data…
Cloning into 'data_tmp'...
remote: Enumerating objects: 2824, done.
remote: Counting objects: 100% (2824/2824), done.
remote: Compressing objects: 100% (2274/2274), done.
remote: Total 2824 (delta 737), reused 1401 (delta 545), pack-reused 0
Receiving objects: 100% (2824/2824), 1.03 MiB | 2.34 MiB/s, done.
Resolving deltas: 100% (737/737), done.
Creating directories…
Copying files…
yarn run v1.22.19
$ /home/dave/git/website/node_modules/.bin/tsm scripts/compile-company-packs.ts
(node:11533) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11533) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: getFormat, transformSource
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_LOADER_CHAIN_INCOMPLETE]: "file:///home/dave/git/website/node_modules/tsm/loader.mjs 'load'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
    at new NodeError (node:internal/errors:399:5)
    at ESMLoader.load (node:internal/modules/esm/loader:613:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11)
    at async link (node:internal/modules/esm/module_job:68:21) {
  code: 'ERR_LOADER_CHAIN_INCOMPLETE'
}

Node.js v18.16.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

real    0m2,180s
user    0m0,451s
sys 0m0,624s
(node:11585) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time
    at emitExperimentalWarning (node:internal/util:238:11)
    at new ESMLoader (node:internal/modules/esm/loader:239:7)
    at node:internal/process/esm_loader:42:19
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/loaders:334:7)
    at requireBuiltin (node:internal/bootstrap/loaders:365:14)
    at node:internal/modules/cjs/loader:149:18
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/loaders:334:7)
    at requireBuiltin (node:internal/bootstrap/loaders:365:14)
    at initializeCJSLoader (node:internal/process/pre_execution:543:21)
    at setupUserModules (node:internal/process/pre_execution:114:3)
(node:11585) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: getFormat, transformSource
    at ESMLoader.pluckHooks (node:internal/modules/esm/loader:299:39)
    at ESMLoader.addCustomLoaders (node:internal/modules/esm/loader:338:21)
    at initializeLoader (node:internal/process/esm_loader:83:19)
    at async loadESM (node:internal/process/esm_loader:90:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_LOADER_CHAIN_INCOMPLETE]: "file:///home/dave/git/website/node_modules/tsm/loader.mjs 'load'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
    at new NodeError (node:internal/errors:399:5)
    at ESMLoader.load (node:internal/modules/esm/loader:613:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:11)
    at async link (node:internal/modules/esm/module_job:68:21) {
  code: 'ERR_LOADER_CHAIN_INCOMPLETE'
}

Node.js v18.16.0
davenewham commented 1 year ago

Updating tsm to >=v2.2.2 should work

davenewham commented 1 year ago

Confirmed that yarn add tsm@"^2.2.2" --dev worked

davenewham commented 1 year ago

And now an error from webpack

$ cross-env BABEL_ENV=production; webpack --mode=production --config webpack.prod.js
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/dave/git/website/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/dave/git/website/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/dave/git/website/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/dave/git/website/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/dave/git/website/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/dave/git/website/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/dave/git/website/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/dave/git/website/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/dave/git/website/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/home/dave/git/website/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /home/dave/git/website/node_modules/babel-loader/lib/index.js:59:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
davenewham commented 1 year ago

Changing build command to cross-env BABEL_ENV=production; NODE_OPTIONS=--openssl-legacy-provider webpack --mode=production --config webpack.prod.js works (without updating to webpack 5)

davenewham commented 1 year ago

But then backwards compatibility is broken :smile:

/home/dave/.nvm/versions/node/v14.21.3/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

baltpeter commented 1 year ago

See also #986.

christian-weiss commented 6 months ago

@davenewham @baltpeter can we close this issue, as migration to newer node version can be done in #986.