Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant run command npm run start from the www folder(following the book) #301

Open
lucitang opened this issue Aug 9, 2023 · 4 comments
Open

Comments

@lucitang
Copy link

lucitang commented Aug 9, 2023

when i run npm run start from the www folder in the project i get an error:

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\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
    at C:\Users\Sarang Dutta\Documents\rust_projects\wasm-game-of-life\www\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9
    at C:\Users\Sarang Dutta\Documents\rust_projects\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.12.1

rustc version: 1.71.0
npm version: 9.8.1

@kaubu
Copy link

kaubu commented Aug 10, 2023

Yep this happened to me too, I fixed it by setting the NODE_OPTIONS environmental variable to --openssl-legacy-provider

I don't have high hopes that this will be added in the book though, since it hasn't been updated since January 2021

@asasine
Copy link

asasine commented Jan 27, 2024

I mitigated this with the same solution (NODE_OPTIONS to --openssl-legacy-provider). You can modify the generated package.json, you don't have to modify your environment.

  1. In the www directory: npm install --save-dev cross-env
  2. Modify the start script to: cross-env NODE_OPTIONS='--openssl-legacy-provider' webpack-dev-server
  3. Run: npm run start

@paphopsaw
Copy link

paphopsaw commented Feb 15, 2024

After I ran npm install I ran npm update and it worked fine.
I guess it has something to do with outdated dependencies that npm init wasm-app provides.

rustwasm/create-wasm-app#206

@glennDittmann
Copy link

glennDittmann commented Mar 9, 2024

There is a solution here: rustwasm/rust-webpack-template#184

@paphopsaw This also worked for me, and is more coherent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants