hibiken / asynqmon

Web UI for Asynq task queue
MIT License
668 stars 152 forks source link

Need better instructions for `make build` on windows #324

Open windowshopr opened 7 months ago

windowshopr commented 7 months ago

Downloading and running the prebuilt Windows binary results in the following error in browser:

image

Reviewing #97 here, it seems the filepath code was designed for Linux systems, resulting in the error. I wanted to implement the fix in the static.go file myself, so I downloaded the source code for the program, made the change, then ran the make build command from a PowerShell window, resulting in the below error:

make build
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.57s.
cd ./ui && yarn build --modules-folder /ui/node_modules
yarn run v1.22.22
$ react-scripts build --modules-folder /ui/node_modules
'react-scripts' 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.
make: *** [Makefile:6: assets] Error 1

...which triggered me to think "oh duh, I forgot to npm install", so I ran that, which resulted in this next output:

npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @material-ui/icons@4.11.3
npm ERR! Found: @material-ui/core@5.0.0-beta.5
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"^5.0.0-beta.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR! node_modules/@material-ui/icons
npm ERR!   @material-ui/icons@"^4.11.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR!   node_modules/@material-ui/icons
npm ERR!     @material-ui/icons@"^4.11.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\cache\_logs\2024-04-20T20_55_18_711Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\cache\_logs\2024-04-20T20_55_18_711Z-debug-0.log

...so I follow the directions of using the --force flag, which gives me this output:

npm install --force
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @material-ui/icons@4.11.3
npm WARN Found: @material-ui/core@5.0.0-beta.5
npm WARN node_modules/@material-ui/core
npm WARN   @material-ui/core@"^5.0.0-beta.5" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm WARN node_modules/@material-ui/icons
npm WARN   @material-ui/icons@"^4.11.3" from the root project
npm WARN
npm WARN Conflicting peer dependency: @material-ui/core@4.12.4
npm WARN node_modules/@material-ui/core
npm WARN   peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm WARN   node_modules/@material-ui/icons
npm WARN     @material-ui/icons@"^4.11.3" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-redux@9.1.1
npm WARN Found: @types/react@17.0.80
npm WARN node_modules/@types/react
npm WARN   peerOptional @types/react@"^16.8.6 || ^17.0.0" from @material-ui/core@5.0.0-beta.5
npm WARN   node_modules/@material-ui/core
npm WARN     @material-ui/core@"^5.0.0-beta.5" from the root project
npm WARN   7 more (@material-ui/icons, @material-ui/private-theming, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional @types/react@"^18.2.25" from react-redux@9.1.1
npm WARN node_modules/react-redux
npm WARN   react-redux@"^9.1.1" from the root project
npm WARN   1 more (@reduxjs/toolkit)
npm WARN
npm WARN Conflicting peer dependency: @types/react@18.2.79
npm WARN node_modules/@types/react
npm WARN   peerOptional @types/react@"^18.2.25" from react-redux@9.1.1
npm WARN   node_modules/react-redux
npm WARN     react-redux@"^9.1.1" from the root project
npm WARN     1 more (@reduxjs/toolkit)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-redux@9.1.1
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@"^17.0.2" from @material-ui/core@5.0.0-beta.5
npm WARN   node_modules/@material-ui/core
npm WARN     @material-ui/core@"^5.0.0-beta.5" from the root project
npm WARN   12 more (@material-ui/icons, @material-ui/private-theming, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^18.0" from react-redux@9.1.1
npm WARN node_modules/react-redux
npm WARN   react-redux@"^9.1.1" from the root project
npm WARN   1 more (@reduxjs/toolkit)
npm WARN
npm WARN Conflicting peer dependency: react@18.2.0
npm WARN node_modules/react
npm WARN   peer react@"^18.0" from react-redux@9.1.1
npm WARN   node_modules/react-redux
npm WARN     react-redux@"^9.1.1" from the root project
npm WARN     1 more (@reduxjs/toolkit)

up to date, audited 253 packages in 3s

6 packages are looking for funding
  run `npm fund` for details

32 vulnerabilities (1 low, 10 moderate, 18 high, 3 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

Finally I try the make build command again:

make build
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.53s.
cd ./ui && yarn build --modules-folder /ui/node_modules
yarn run v1.22.22
$ react-scripts build --modules-folder /ui/node_modules
'react-scripts' 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.
make: *** [Makefile:6: assets] Error 1

Same issue as before, react-scripts is not installed. After some digging online, the NOT ideal solution is to globally install react-scripts using the command npm i -g react-scripts@latest --force followed by the make build again:

make build
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.54s.
cd ./ui && yarn build --modules-folder /ui/node_modules
yarn run v1.22.22
$ react-scripts build --modules-folder /ui/node_modules
Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve '@material-ui/lab/Alert' in 'C:\Users\chalu\Desktop\asynqmon-master\ui\src\views'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [Makefile:6: assets] Error 1

Something is off here, because now it seems it's sending me down a rabbit hole of installing all of the packages.json packages to a global scope, one at a time. npm install install is not doing what it's supposed to.

Can someone try following the documentation in a Windows 10 environment and let me know what I'm missing here?

windowshopr commented 7 months ago

For further context, I've also tried to manually running the backend server with go run main.go --port 8085, and then attempting to run the frontend server with npm run start which results in a giant output of issues, and a browser window that all looks like the following:

image

Unless I'm missing something obvious here, the package just simply doesn't work on Windows.

windowshopr commented 7 months ago

Oh, and I forgot that the packages.json needs to modify export to set at this line in order to work on Windows:

image