create-wasm-app won't run on node 18 on windows
as it is, it won't run thanks to very outdated dependencies. Maybe simply don't use the bundler at all?
> npm run start
> [email protected] start
> webpack-dev-server
(node:33908) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
i 「wds」: Project is running at http://localhost:8080/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from %HOME%\ok\wasm\wasm-test\www
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%\ok\wasm\wasm-test\www\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (%HOME%\ok\wasm\wasm-test\www\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (%HOME%\ok\wasm\wasm-test\www\node_modules\webpack\lib\NormalModule.js:471:10)
at %HOME%\ok\wasm\wasm-test\www\node_modules\webpack\lib\NormalModule.js:503:5
at %HOME%\ok\wasm\wasm-test\www\node_modules\webpack\lib\NormalModule.js:358:12
at %HOME%\ok\wasm\wasm-test\www\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (%HOME%\ok\wasm\wasm-test\www\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (%HOME%\ok\wasm\wasm-test\www\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (%HOME%\ok\wasm\wasm-test\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
at %HOME%\ok\wasm\wasm-test\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9
at %HOME%\ok\wasm\wasm-test\www\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.6.0
Same problem here. For a temporary fix, use node 16 or any version below 16.
This pull request adds a hint to a solution for this while keeping a newer version of node.
The suggestion is to add a NODE_OPTIONS environment variable that includes the --openssl-legacy-provider flag. I tested this with the following package.json file and it worked for me.
{
...
"scripts": {
...
"start": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server"
},
...
}
If you want to change the environment variable on Windows you can run this command in the terminal before running npm run start:
$env:NODE_OPTIONS="--openssl-legacy-provider"
Edit: alternative solution
Same issue on macos. Downgrading to node 16 works.