eventespresso / barista

Javascript modules & tools for Event Espresso development
GNU General Public License v3.0
5 stars 1 forks source link

Remove support for Node v16 Gallium #1326

Closed alexkuc closed 2 months ago

alexkuc commented 2 months ago

Fix #1325

alexkuc commented 2 months ago

Going to refrain from merging until it is confirmed with @kingrio13 and @Saam01 that they are okay to proceed with Node v20.

Edit: link to Slack conversation

kingrio13 commented 2 months ago
yarn dev:all
yarn run v1.22.22
$ yarn dev:watch --domains "all"
$ NODE_OPTIONS=--openssl-legacy-provider node scripts/watch.js --domains all
'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
alexkuc commented 2 months ago

@kingrio13 I've removed the offended code, could you try again please? In addition to dev, please also try build i.e. yarn run build. Also, could you please share you have updated the Node so I can notify @Saam01 as well, please?

Saam01 commented 2 months ago

@alexkuc I'm still facing the same error:

image

alexkuc commented 2 months ago

@Saam01 Have you pulled the latest changes from this branch? Since Rio's message I've added a commit to address that specific issue.

kingrio13 commented 2 months ago

@alexkuc this is my setup image

PS C:\xampp\htdocs\barista\wp-content\plugins\barista> yarn dev:all
yarn run v1.22.22
$ yarn dev:watch --domains "all"
$ node scripts/watch.js --domains all
domains:  [
  'blocks',
  'eventEditor',
  'wpPluginsPage',
  'esEdtrSlots',
  'esUpsellEditor',
  'rem',
  'wpUser'
]
packages:  [
  'adapters',       'config',
  'constants',      'data',
  'dates',          'edtrServices',
  'eeComponents',   'events',
  'formBuilder',    'form',
  'helpers',        'hooks',
  'i18n',           'ioc',
  'plugins',        'predicates',
  'registry',       'richTextEditor',
  'rruleGenerator', 'services',
  'slotFill',       'storage',
  'styles',         'toaster',
  'tpc',            'types',
  'uiComponents',   'utils'
]
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module 'sanitize.css/page.css'
Require stack:
- C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\postcss-normalize\dist\index.cjs.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at resolve (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\postcss-normalize\dist\index.cjs.js:46:46)
    at Object.<anonymous> (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\postcss-normalize\dist\index.cjs.js:22:25)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\xampp\htdocs\barista\wp-content\plugins\barista\config\webpack.config.js:25:26) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\xampp\\htdocs\\barista\\wp-content\\plugins\\barista\\node_modules\\postcss-normalize\\dist\\index.cjs.js'
  ]
}

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

!

Saam01 commented 2 months ago

@alexkuc I'm facing using the same with latest changes.

C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista>yarn dev:all
yarn run v1.22.22
$ yarn dev:watch --domains "all"
$ node scripts/watch.js --domains all
domains:  [
  'blocks',
  'eventEditor',
  'wpPluginsPage',
  'esEdtrSlots',
  'esUpsellEditor',
  'rem',
  'wpUser'
]
packages:  [
  'adapters',       'config',
  'constants',      'data',
  'dates',          'edtrServices',
  'eeComponents',   'events',
  'formBuilder',    'form',
  'helpers',        'hooks',
  'i18n',           'ioc',
  'plugins',        'predicates',
  'registry',       'richTextEditor',
  'rruleGenerator', 'services',
  'slotFill',       'storage',
  'styles',         'toaster',
  'tpc',            'types',
  'uiComponents',   'utils'
]
node:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Users\star\Local Sites\new-barista-1\app\public\wp-content\plugins\barista\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

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

Still having some errors at the bottom

alexkuc commented 2 months ago

@kingrio13 In the future, when you have output that is more than 1-2 lines, please format it as codeblock (example)

Edit: I've formatted yours by editing your message, as you can see it is now much much easier to read the output

alexkuc commented 2 months ago

@kingrio13 @Saam01 Please try the following:

Please let me know your output/come. Thank you.

kingrio13 commented 2 months ago

@alexkuc

Oh, i thought node module is from the PR so i did not delete and install.

but here's what happen, Success install, i did not copy the whole part of it. the last few lines. But i encounter problem on yarn build


$ yarn build:cra --domains "all"
$ NODE_OPTIONS=--openssl-legacy-provider node scripts/build.js --domains all
'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.```

Then i did run yarn dev:all and i got this error.

node:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

<hr>

[5/5] Building fresh packages...
$ yarn generate:workspaces && husky install
yarn run v1.22.22
$ node scripts/generateWorkspaces.js
Done in 4.11s.
husky - Git hooks installed
Done in 112.05s.
PS C:\xampp\htdocs\barista\wp-content\plugins\barista> yarn build
yarn run v1.22.22
$ yarn build:cra --domains "all"
$ NODE_OPTIONS=--openssl-legacy-provider node scripts/build.js --domains all
'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\xampp\htdocs\barista\wp-content\plugins\barista> yarn dev:all
yarn run v1.22.22
$ yarn dev:watch --domains "all"
$ node scripts/watch.js --domains all
domains:  [
  'blocks',
  'eventEditor',
  'wpPluginsPage',
  'esEdtrSlots',
  'esUpsellEditor',
  'rem',
  'wpUser'
]
packages:  [
  'adapters',       'config',
  'constants',      'data',
  'dates',          'edtrServices',
  'eeComponents',   'events',
  'formBuilder',    'form',
  'helpers',        'hooks',
  'i18n',           'ioc',
  'plugins',        'predicates',
  'registry',       'richTextEditor',
  'rruleGenerator', 'services',
  'slotFill',       'storage',
  'styles',         'toaster',
  'tpc',            'types',
  'uiComponents',   'utils'
]
node:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v20.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\xampp\htdocs\barista\wp-content\plugins\barista>
alexkuc commented 2 months ago

@kingrio13 Are you sure you've pulled the latest changes from the PR?

Asking because NODE_OPTIONS=--openssl-legacy-provider was removed (you can see so in the Files changed)

Edit: nevermind, I forgot to remove it

Saam01 commented 2 months ago

@alexkuc Tested the above as mentioned and yes, I'm on Node 20.

C:\Users\star\Local Sites\node-20-barista\app\public\wp-content\plugins\barista>git pull
Already up to date.

C:\Users\star\Local Sites\node-20-barista\app\public\wp-content\plugins\barista>node -v
v20.14.0

C:\Users\star\Local Sites\node-20-barista\app\public\wp-content\plugins\barista>node_modules
'node_modules' is not recognized as an internal or external command,
operable program or batch file.

Getting the same error as yesterday if I run the yarn build

image

alexkuc commented 2 months ago

@kingrio13 I've just pushed changes where all NODE_OPTIONS have been removed. Please pull latest changes from the branch and try again. Sorry for the back-and-forth! :(

Edit: same for you @Saam01

Saam01 commented 2 months ago

@alexkuc Not sure why but after testing on a fresh installation I'm still getting this error on yarn build:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
    at C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:236:3
    at context.callback (C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Users\star\Local Sites\node-20-barista-1\app\public\wp-content\plugins\barista\node_modules\babel-loader\lib\index.js:59:71 {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

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

image

kingrio13 commented 2 months ago

This is what i also experienced.


$ yarn dev:watch --domains "all"
$ node scripts/watch.js --domains all
domains:  [
  'blocks',
  'eventEditor',
  'wpPluginsPage',
  'esEdtrSlots',
  'esUpsellEditor',
  'rem',
  'wpUser'
]
packages:  [
  'adapters',       'config',
  'constants',      'data',
  'dates',          'edtrServices',
  'eeComponents',   'events',
  'formBuilder',    'form',
  'helpers',        'hooks',
  'i18n',           'ioc',
  'plugins',        'predicates',
  'registry',       'richTextEditor',
  'rruleGenerator', 'services',
  'slotFill',       'storage',
  'styles',         'toaster',
  'tpc',            'types',
  'uiComponents',   'utils'
]
node:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:79:19)
    at Object.createHash (node:crypto:139:10)
    at module.exports (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\xampp\htdocs\barista\wp-content\plugins\barista\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [
    'error:03000086:digital envelope routines::initialization error',
    'error:0308010C:digital envelope routines::unsupported'
  ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v20.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
alexkuc commented 2 months ago

This is weird… :/ clearly you are on the latest branch version, with Node v20 yet it still fails. I will need to set up a Win10 machine myself to try and replicate this issue. I am on Linux and don't experience this so could be OS-specific.

kingrio13 commented 2 months ago

@alexkuc Maybe we can try this? https://github.com/AgoraIO/Agora-Chat-API-Examples/issues/83

alexkuc commented 2 months ago

@kingrio13 The thing is that it should not be required as

a) you are on Node v20 b) this branch introduces dependency updates which use newer SSL version

Given how this issue/PR blocks further testing on Barista, I will escalate priority and focus on this today.

alexkuc commented 2 months ago

@kingrio13 @Saam01

Once Brent has approved the PR, please follow the following to test this PR:

tn3rb commented 2 months ago

@alexkuc

@Saam01 && @kingrio13 are both getting the ERR_OSSL_EVP_UNSUPPORTED error which indicates the need to keep the --openssl-legacy-provider flag OR find out why their systems are not generating a sufficiently sized key.

Maybe something like this would help: https://stackoverflow.com/a/69691525 ???

alexkuc commented 2 months ago

@tn3rb That flag is already included in this PR

tn3rb commented 2 months ago

@alexkuc

you said you've removed that flag: https://github.com/eventespresso/barista/pull/1326#issuecomment-2178930699

Also maybe verify that @Saam01 && @kingrio13 both have OpenSSL installed on their systems (although I'm not sure if they need that or not). My guess is they don't have any appropriate cryptographic hashing algorithms installed and that's why they are getting that error. installing OpenSSL should add some usable algorithms.

alexkuc commented 2 months ago

@tn3rb Yes, and then I have restored it.

Edit: which is why I have added git reset --hard in my latest testing instructions

kingrio13 commented 2 months ago

All good in my end. image

image

Saam01 commented 2 months ago

Working fine for me as well image