vacuumlabs / adalite

A lightweight web wallet for Cardano cryptocurrency with Trezor, Ledger and BitBox02 support. Please note that the only valid domain for our wallet is adalite.io
https://adalite.io
235 stars 49 forks source link

Local adalite does not build and work on Windows #1391

Closed xezon closed 7 months ago

xezon commented 1 year ago

Using

Windows 10 yarn v1.22.19 node-v18.12.0-x64

D:\Projects\vacuumlabs\adalite>yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
$ cd app && yarn install && cd ..
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.23s.
Done in 63.99s.

D:\Projects\vacuumlabs\adalite>yarn build
yarn run v1.22.19
$ NODE_ENV=production webpack --progress --config webpack.build.config.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I searched for NODE_ENV error title:

https://stackoverflow.com/questions/11928013/node-env-is-not-recognized-as-an-internal-or-external-command-operable-comman

I added & symbol to package.json as per stackoverflow comments:

    "start-server": "NODE_ENV=production & node server/index.js",
    "build": "NODE_ENV=production & webpack --progress --config webpack.build.config.js",

It then builds and starts like so:

D:\Projects\vacuumlabs\adalite>yarn build
yarn run v1.22.19
$ NODE_ENV=production & webpack --progress --config webpack.build.config.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
assets by info 92 KiB [immutable]
  assets by path *.woff 44.8 KiB
    asset d912fb8de0fe89e79df89061e962fa0c.woff 22.6 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-bold-webfont.woff] (auxiliary name: main)
    asset c9f103727772e832dc34f317bbed917c.woff 22.2 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-medium-webfont.woff] (auxiliary name: main)
  assets by path *.woff2 36 KiB
    asset 99743ab304c2c335cf77f02eedb794ea.woff2 18.1 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-medium-webfont.woff2] (auxiliary name: main)
    asset 8a9147a71c202309548929879436487c.woff2 17.8 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-bold-webfont.woff2] (auxiliary name: main)
  asset eb382ddcab4f6d516887e4cee28790ef.svg 11.2 KiB [emitted] [immutable] [from: app/public/assets/donation_icon_ada.svg] (auxiliary name: main)
assets by path js/*.js 13.1 MiB
  asset js/main.bundle.js 6.6 MiB [emitted] (name: main) 1 related asset
  asset js/bitbox02-api.bundle.js 6.54 MiB [emitted] (name: bitbox02-api) 1 related asset
runtime modules 30.2 KiB 18 modules
orphan modules 14.6 KiB [orphan] 14 modules
modules by path ./app/node_modules/ 10.1 MiB
  javascript modules 10 MiB 862 modules
  json modules 138 KiB 9 modules
modules by path ./app/frontend/ 1.08 MiB 229 modules
modules by path ./app/public/ 428 KiB
  modules by path ./app/public/assets/*.svg 104 KiB 54 modules
  modules by path ./app/public/css/*.css 324 KiB 16 modules
  modules by path ./app/public/fonts/ 326 bytes 4 modules
modules by path ./node_modules/ 340 KiB 44 modules
+ 5 modules

WARNING in ./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js 13:20-27
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./app/node_modules/bitbox02-api/lib/bitbox02.js 9:21-52
 @ ./app/node_modules/bitbox02-api/lib/index.js 45:14-38
 @ ./app/frontend/wallet/shelley/shelley-bitbox02-crypto-provider.ts 314:45-106
 @ ./app/frontend/wallet/shelley/shelley-crypto-provider-factory.ts 3:0-79 11:23-52
 @ ./app/frontend/actions/wallet.ts 49:0-93 183:45-91
 @ ./app/frontend/actions.ts 23:0-45 26:440-453
 @ ./app/frontend/components/autoLogout.ts 16:0-33 78:7-14
 @ ./app/frontend/components/app.tsx 10:0-38 42:42-52
 @ ./app/frontend/walletApp.js 99:14-49

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.76.2 compiled with 1 warning in 15535 ms
Done in 16.60s.

D:\Projects\vacuumlabs\adalite>ADALITE_ENABLE_HTTPS=true ADALITE_PORT=3000 yarn start-server
'ADALITE_ENABLE_HTTPS' is not recognized as an internal or external command,
operable program or batch file.

D:\Projects\vacuumlabs\adalite>yarn start-server
yarn run v1.22.19
$ NODE_ENV=production & node server/index.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
<i> [webpack-dev-middleware] wait until bundle finished
webpack built ae80b64ff29e9dee916b in 15660ms
assets by info 92 KiB [immutable]
  assets by path *.woff 44.8 KiB
    asset d912fb8de0fe89e79df89061e962fa0c.woff 22.6 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-bold-webfont.woff] (auxiliary name: main)
    asset c9f103727772e832dc34f317bbed917c.woff 22.2 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-medium-webfont.woff] (auxiliary name: main)
  assets by path *.woff2 36 KiB
    asset 99743ab304c2c335cf77f02eedb794ea.woff2 18.1 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-medium-webfont.woff2] (auxiliary name: main)
    asset 8a9147a71c202309548929879436487c.woff2 17.8 KiB [emitted] [immutable] [from: app/public/fonts/jtmarnie-bold-webfont.woff2] (auxiliary name: main)
  asset eb382ddcab4f6d516887e4cee28790ef.svg 11.2 KiB [emitted] [immutable] [from: app/public/assets/donation_icon_ada.svg] (auxiliary name: main)
assets by path js/*.js 13.1 MiB
  asset js/main.bundle.js 6.6 MiB [emitted] (name: main) 1 related asset
  asset js/bitbox02-api.bundle.js 6.54 MiB [emitted] (name: bitbox02-api) 1 related asset
runtime modules 30.2 KiB 18 modules
orphan modules 14.6 KiB [orphan] 14 modules
modules by path ./app/node_modules/ 10.1 MiB
  javascript modules 10 MiB 862 modules
  json modules 138 KiB 9 modules
modules by path ./app/frontend/ 1.08 MiB 229 modules
modules by path ./app/public/ 428 KiB
  modules by path ./app/public/assets/*.svg 104 KiB 54 modules
  modules by path ./app/public/css/*.css 324 KiB 16 modules
  modules by path ./app/public/fonts/ 326 bytes 4 modules
modules by path ./node_modules/ 340 KiB 44 modules
+ 5 modules

WARNING in ./app/node_modules/bitbox02-api/lib/bitbox02-api-go.js 13:20-27
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./app/node_modules/bitbox02-api/lib/bitbox02.js 9:21-52
 @ ./app/node_modules/bitbox02-api/lib/index.js 45:14-38
 @ ./app/frontend/wallet/shelley/shelley-bitbox02-crypto-provider.ts 314:45-106
 @ ./app/frontend/wallet/shelley/shelley-crypto-provider-factory.ts 3:0-79 11:23-52
 @ ./app/frontend/actions/wallet.ts 49:0-93 183:45-91
 @ ./app/frontend/actions.ts 23:0-45 26:440-453
 @ ./app/frontend/components/errorBoundary.tsx 17:0-33 42:7-14
 @ ./app/frontend/components/app.tsx 14:0-44 37:10-23
 @ ./app/frontend/walletApp.js 99:14-49

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.76.2 compiled with 1 warning in 15660 ms
Server is listening on  port 3000!

Opening https://localhost:3000/ in Firefox reports:

Secure Connection Failed

An error occurred during a connection to localhost:3000. SSL received a record that exceeded the maximum permissible length.

Error code: SSL_ERROR_RX_RECORD_TOO_LONG

    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem.

Opening https://localhost:3000/ in Chrome reports:

This site can’t provide a secure connectionlocalhost sent an invalid response.
[Try running Windows Network Diagnostics](javascript:diagnoseErrors()).
ERR_SSL_PROTOCOL_ERROR

Perhaps you can make it possible to build on Windows right out of the box.

And for the SSL error, unclear to me how to open http page. Browsers do not allow this. They want to open https page, perhaps because adalite still poses as a https page when it should not?

Attempting to launch with ADALITE_ENABLE_HTTPS=true will fail.

yarn run v1.22.19
$ NODE_ENV=production & node server/index.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
<i> [webpack-dev-middleware] wait until bundle finished
node:internal/fs/utils:348
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'server.cert'
    at Object.openSync (node:fs:600:3)
    at Object.readFileSync (node:fs:468:35)
    at Object.<anonymous> (D:\Projects\vacuumlabs\adalite\server\index.js:177:14)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'server.cert'
}

Node.js v18.12.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
refi93 commented 8 months ago

sorry for the late reply, the preferred way to run the project locally is using yarn dev which I'd expect to work fine even on Windows.

When it comes to the browser HTTPS errors when ENABLE_LOCAL_HTTPS is set to true, this flag shouldn't really be used in production mode, only in development and then a self-signed HTTPS certificate is used. The browsers may still "complain" that the certificate is invalid, but they should allow you through by clicking "proceed anyway" or a similar button that would be visible on the error page

For the best windows development experience I'd recommend using WSL https://ubuntu.com/desktop/wsl which should remove any environment-specific incompatibilities this project has, given it is being developed and hosted on UNIX environments