Does Twilio Flex UI support Node 18 and NPM 8? - node.js

I am trying to follow the instructions from Twilio Flex found at: Twilio Flex Quickstart: Getting Started with React Plugin Development
I keep running into errors and can not figure them out. I've tried doing this on Windows and macOS and it's the same result. I am using NVM to use Node.js v18.13.0 and NPM v8.19.3. The only thing I can think of is that maybe Twilio Flex does not support the current versions of Node and NPM. Does anyone know what I'm doing wrong?
Terminal output:
Starting development server (static)...
ℹ 「wds」: Project is running at http://localhost:3100//
ℹ 「wds」: webpack output is served from undefined
ℹ 「wds」: Content not from webpack is served from /Users/username/plugin-sample
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 (/Users/username/.twilio-cli/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/username/.twilio-cli/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/username/.twilio-cli/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/username/.twilio-cli/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/username/.twilio-cli/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/username/.twilio-cli/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/username/.twilio-cli/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/Users/username/.twilio-cli/node_modules/loader-runner/lib/LoaderRunner.js:205:4) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.13.0
Here is the commands I have run so far (in order):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
brew tap twilio/brew && brew install twilio
twilio login
twilio flex:plugins:create plugin-sample --install --flexui2
cd plugin-sample
twilio flex:plugins:start
I have tried installing legacy versions of Node 16 and Node 14 with varying degrees of success. At one point I was able to actually have the plugin running on localhost but I had many errors and it would not let me publish the plugin. Since then, I have not been able to recreate this somewhat successful output.

According to the installation instructions, Node 10.12 through 14 are supported. They are working towards support for 16. So using node 18 would be a very likely cause of the error.
You can switch to a supported version by doing nvm install 14.
To keep this version as your new default, you'll need to set it: nvm alias default 14.

Related

The default project created by preact-cli "^3.4.2" doesn't run

I'm trying to start a preact project. But the default template created by preact-cli doesn't run. Here's what I did:
npx preact-cli create default my-project
cd my-project
npm install # this is not necessary I think
npm run dev
This results in an error message:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
Some versions:
npx and npm are 8.12.1
node is v18.12.1
operating system:
Distributor ID: Pop
Description: Pop!_OS 22.04 LTS
Release: 22.04
Codename: jammy
Online version on Stackblitz:
To make the question easier to answer, I created an online example on Stackblitz: https://stackblitz.com/edit/node-zby5qu?file=src%2Findex.js
This works!
As a first attempt at solving my problem, I copied the package-lock.json file from stackblitz to my local machine and reinstalled dependencies. But the problem persists.
So it seems that this is related to my local machine.
Related questions:
This question advises to switch to Node version 16: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19)
And this issue https://github.com/matiasdelellis/facerecognition/issues/613 says that an outdated version of react-scripts can cause the problem.
By now Node 18.13 is the LTS version, I don't want to downgrade to 16.
And as far as I can see, I have the latest version of preact-cli. From my package-lock file:
"node_modules/preact-cli": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/preact-cli/-/preact-cli-3.4.4.tgz",
The latest version has been published 3 days ago: https://www.npmjs.com/package/preact-cli?activeTab=readme
Copying my answer from preact-cli's repo:
Preact-CLI v3 is built upon Webpack v4, which does not support newer versions of Node out-of-the-box. Breaking change in Node caused a lot of ecosystem issues.
However, you don't need to downgrade; instead, you can set NODE_OPTIONS=--openssl-legacy-provider. If you're on a non-Windows system, that can be done by making the following alteration to your package.json:
{
"scripts": {
"dev": "NODE_OPTIONS=--openssl-legacy-provider preact watch"
"build": "NODE_OPTIONS=--openssl-legacy-provider preact build"
}
}
We do have a prerelease published for CLI, available as 4.0.0-next.1. If you wish to use it, I'd recommend initializing a new project with the following:
$ [npm init / yarn create] preact-cli default my-project

Angular 14 project installation

I am facing the following issue. Error posted down. Please share your answer I am waiting for valuable feedback.
DEPRECATED: The 'defaultProject' workspace option has been deprecated. The project to use will be determined from the current working directory.
Your global Angular CLI version (15.0.4) is greater than your local version (11.2.19). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
\ Generating browser application bundles (phase: building)...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 (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\webpack\lib\NormalModule.js:503:5
at C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\webpack\lib\NormalModule.js:358:12
at C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at context.callback (C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08\node_modules\babel-loader\lib\index.js:59:71
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.1
C:\Users\Sonal.D\runner\krushna_m-runner_web_admin-1241444b7c08>export NODE_OPTIONS=--openssl-legacy-provider
'export' is not recognized as an internal or external command,
operable program or batch file.
I tried these:-
Node version uninstall and install.
cli version uninstall and install.
The following commands are used:-
npm install -g #angular/cli
npm install -g #angular/cli#latest
If you try ng --version with angular cli 14, you will get that error. Please use ng version instead.

after remove nop_modules and change windows install latest nodejs my app not working

i done
windows change format C
install node lastest
remove node_modules in my project folder
i do npm install & all --force and -- other but i see finaly error
and other project also contain node_modules also not loading
「wds」: 404s will fallback to //index.html
10% building 3/4 modules 1 active ...js?http://0.0.0.0:0/sockjs-nodenode:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
node_modules\webpack\lib\util\createHash.js:90:53
digital envelope routines::unsupported
Please try to install the stable node.js version from here. Please refer to this answer.

how to update reactjs project to nodejs v18.12.0 and npm v8.19.2?

I installed nodejs 18.12.0 and I want to run my reactjs project, after npm start it gives me this errors:
Compiled with problems:X
ERROR in ./src/assets/images/arrow_vector.svg
Module build failed (from ./node_modules/file-loader/dist/cjs.js):
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at getHashDigest (E:\project\KhazaeiCRM-main\node_modules\loader-utils\lib\getHashDigest.js:46:34)
at E:\project\KhazaeiCRM-main\node_modules\loader-utils\lib\interpolateName.js:113:11
at String.replace ()
at interpolateName (E:\project\KhazaeiCRM-main\node_modules\loader-utils\lib\interpolateName.js:110:8)
at Object.loader (E:\project\KhazaeiCRM-main\node_modules\file-loader\dist\index.js:29:48)
after some research, they told me that must install lower version of nodejs,
so I install nodejs 16 and new error is:
Error: PostCSS plugin postcss-import requires PostCSS 8
the solution is to install latest version of nodejs !!
what can I do to update my reactjs project to the latest nodejs version ?
maybe you should use nvm to easy choose other node.js version to run app.

React Native Node

Could not start metro bundler
Getting following error while executing
command : npx react-native start
Node Version : v17.3.0
Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported
You can find solution for this question Here
This error is occuring in Node.js 17. Downgrade your node version to an older version (~16).

Resources