Tucsky / aggr

Cryptocurrency trades aggregator
https://charts.aggr.trade/
GNU General Public License v3.0
830 stars 240 forks source link

"aggr" just blew up in Windows Power Shell #288

Closed DROBNJAK closed 1 year ago

DROBNJAK commented 1 year ago

Thanks for reporting an issue, please review the task list below before submitting the issue :

Describe the issue

...

Steps to reproduce

(Preferably from a clean environment / incognito mode)

  1. TODO
  2. TODO
  3. TODO ...
DROBNJAK commented 1 year ago

I wasted a whole day trying to install node.js & npm on Win 10, and finally when I got it all working "aggr" blew up. Here is the output:

PS C:\tmp\aggr> npm run serve

aggr@3.3.1 serve vue-cli-service serve

INFO Starting development server... 10% building 2/5 modules 3 active ...C:\tmp\aggr\node_modules\eslint-loader\index.js??ref--14-0!C:\tmp\aggr\src\main.tsnode: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:\tmp\aggr\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:471:10) at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:503:5 at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:358:12 at C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at Array. (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:205:4) at Storage.finished (C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16) at C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9 at C:\tmp\aggr\node_modules\graceful-fs\graceful-fs.js:123: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.15.0

Tucsky commented 1 year ago

looks like you just need to downgrade nodejs

adeacetis commented 1 year ago

It is not necessary to downgrade your nodejs. This is happening because NodeJS >= 17 introduced OpenSSL 3.

image

The app uses Webpack version 4. This would require to be updated but it's an internal dependency, we have little power over that.

On Windows, you can run this prefix before all your npm scripts and you'll do fine: set NODE_OPTIONS=--openssl-legacy-provider &&

If you are on Linux or MacOS, use instead: EXPORT NODE_OPTIONS=--openssl-legacy-provider &&

image

However, note that one deep dependency doesn't do well with Node being above 14. I've been investigating this.

Edit your package.json accordingly.

DROBNJAK commented 1 year ago

First I did what you suggested first. There was an improvement and server kicked in, but it eventually failed ( Power Shell on Win 10, from "aggr" directory ):

PS C:\tmp\aggr> set NODE_OPTIONS=--openssl-legacy-provider PS C:\tmp\aggr> npm run serve

aggr@3.3.1 serve vue-cli-service serve

INFO Starting development server... 10% building 2/3 modules 1 active ...C:\tmp\aggr\node_modules\eslint-loader\index.js??ref--14-0!C:\tmp\aggr\src\main.tsError: 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:\tmp\aggr\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:471:10) at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:503:5 at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:358:12 at C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at iterateNormalLoaders (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:221:10) at C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:236:3 at runSyncOrAsync (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:130:11) at iterateNormalLoaders (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:232:2) at Array. (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:205:4) at Storage.finished (C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16) at C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9 10% building 2/5 modules 3 active C:\tmp\aggr\node_modules\webpack\hot\dev-server.jsnode: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:\tmp\aggr\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:417:16) at handleParseError (C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:471:10) at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:503:5 at C:\tmp\aggr\node_modules\webpack\lib\NormalModule.js:358:12 at C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:373:3 at iterateNormalLoaders (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:214:10) at Array. (C:\tmp\aggr\node_modules\loader-runner\lib\LoaderRunner.js:205:4) at Storage.finished (C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16) at C:\tmp\aggr\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9 at C:\tmp\aggr\node_modules\graceful-fs\graceful-fs.js:123: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' }

So, I run a second attempt, where I changed my "package.json" file according to your instructions in the above snippet. This time it failed immediately, with these messages:

PS C:\tmp\aggr> set NODE_OPTIONS=--openssl-legacy-provider PS C:\tmp\aggr> npm run serve

aggr@3.3.1 serve set NODE_OPTIONS=--openssl-legacy-rovider && vue-cli-service serve

node: --openssl-legacy-rovider is not allowed in NODE_OPTIONS

DROBNJAK commented 1 year ago

Please, let me know if you have any more ideas, because I hate downgrading.

But, in the worst case, what is the lowest downgrade version that will be safe?

adeacetis commented 1 year ago

I also tried to do that in PowerShell directly but it didn't work. You have to edit the npm run serve script located in package.json as proposed above.

Should look like so:

  "scripts": {
    "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "prod": "set NODE_OPTIONS=--openssl-legacy-provider  && vue-cli-service build --dest ./temp && rm -rf ./dist && mv ./temp ./dist",
    "build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
    "lint": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint",
    "deploy": "node scripts/gh-pages-deploy.js --openssl-legacy-provider"
  },
DROBNJAK commented 1 year ago

OK, I uninstalled Node.js v18.15.0 and installed v16.19.1 from this link:

https://nodejs.org/download/release/v16.19.1/

Then I used this file "node-v16.19.1-x64.msi" because I'm on Win 10.

And it worked phenomenally, right off the bat. Thanks for the help.

Tucsky commented 1 year ago

Next time consider using Volta for managing node versions It takes the version used by the project, and will install it for you as soon as you run a node command (or npm) in tha project folder Here I use node 10

adeacetis commented 1 year ago

@Tucsky I ran some tests to see if we could upgrade NodeJS in the project and found that when I tried to install the project with NodeJS v18.5, webpack-dashboard has a dependency on a package that only supports NodeJS v17 and below.

I switched to NodeJS 17 and it showed that other dependencies require NodeJS v14, v16, or v18. Based on this information, it appears that the project is currently limited to using NodeJS v16, which is the latest LTS version that both dependencies support.

In conclusion, I recommend staying within the supported range of versions for all project dependencies to avoid potential compatibility issues and security vulnerabilities.