create-wasm-app
create-wasm-app copied to clipboard
Fails to run with latest node
Hello,
When running under Node v20.17.0, I'm affected by https://github.com/webpack/webpack/issues/14532 and getting the following error:
michel@debian:/dev/shm/wasm-test/www$ npm run start
> [email protected] start
> webpack-dev-server
(node:651137) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /dev/shm/wasm-test/www
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 (/dev/shm/wasm-test/www/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/dev/shm/wasm-test/www/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/dev/shm/wasm-test/www/node_modules/webpack/lib/NormalModule.js:471:10)
at /dev/shm/wasm-test/www/node_modules/webpack/lib/NormalModule.js:503:5
at /dev/shm/wasm-test/www/node_modules/webpack/lib/NormalModule.js:358:12
at /dev/shm/wasm-test/www/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/dev/shm/wasm-test/www/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/dev/shm/wasm-test/www/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/dev/shm/wasm-test/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at /dev/shm/wasm-test/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
at /dev/shm/wasm-test/www/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
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.17.0
Adding to this, I get the same error when running on node 18.18.1
vscode ➜ /workspaces/wasm-game-of-life/www (master) $ npm run start
> [email protected] start
> webpack-dev-server
(node:15498) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /workspaces/wasm-game-of-life/www
node:internal/crypto/hash:69
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/workspaces/wasm-game-of-life/www/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/workspaces/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/workspaces/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:471:10)
at /workspaces/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:503:5
at /workspaces/wasm-game-of-life/www/node_modules/webpack/lib/NormalModule.js:358:12
at /workspaces/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/workspaces/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/workspaces/wasm-game-of-life/www/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/workspaces/wasm-game-of-life/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at /workspaces/wasm-game-of-life/www/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
at /workspaces/wasm-game-of-life/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.18.1
Some workarounds
- From a related issue in
wasm_game_of_liferepo: https://github.com/rustwasm/wasm_game_of_life/issues/115
Start app with
NODE_OPTIONS=--openssl-legacy-provider npm run start
- Update dependencies
"devDependencies": {
"hello-wasm-pack": "^0.1.0",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
"copy-webpack-plugin": "^12.0.2"
}
With those dependency updates, I also needed to change the webpack.config.js (only changes shown)
plugins: [
new CopyWebpackPlugin({patterns: ['index.html']})
],
experiments: {
asyncWebAssembly: true,
},
There's already an open PR for this https://github.com/rustwasm/create-wasm-app/pull/211
From August 2023... I guess this repo's dead.