Open PeterHaughie opened 1 year ago
Hi!
I finally finally got this working.
Step 1) Run commans:
On Unix-like (Linux, macOS, Git bash, etc.): export NODE_OPTIONS=--openssl-legacy-provider
On Windows command prompt: set NODE_OPTIONS=--openssl-legacy-provider
On PowerShell: $env:NODE_OPTIONS = "--openssl-legacy-provider"
Step 2) Delete package.lock.json
Step 3) In package.json change "scripts" section to:
"scripts": { "crabuild": "react-scripts --openssl-legacy-provider build", "craeject": "react-scripts --openssl-legacy-provider eject", "crastart": "react-scripts --openssl-legacy-provider start", "cratest": "react-scripts --openssl-legacy-provider test", "build": "wptheme-scripts --openssl-legacy-provider build", "start": "wptheme-scripts --openssl-legacy-providerstart", "wpbuild": "wptheme-scripts --openssl-legacy-provider wpbuild", "wpstart": "wptheme-scripts --openssl-legacy-provider wpstart" }, Step 4) If the second time, we get a 8090 port in use error, find out which port by using command: sudo lsof -i :8090
then kill the process by using PID.
sudo kill -9
Then restart by using command sudo npm run wpstart
When using node 18 the wpstart and wpbuild scripts bail with errors:
This is due to the webpack using the SHA512 hash which has been replaced in Webpack5 with xxhash64. The solutions are either to update the Webpack version to 5 and methodically go through all of the webpack build scripts to fix the breaking API changes or to try and enforce a different hashing algorithm in Webpack4 with something along the lines of:
https://webpack.js.org/configuration/output/#outputhashfunction
https://webpack.js.org/configuration/experiments/#experimentsfuturedefaults