Giter VIP home page Giter VIP logo

Comments (12)

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024 1

Actually, Perseus does require Powershell! For most commands, because there can be all sorts of issues with PATH configurations that we've had in the past (mostly legacy from v0.1.0), we run them in a shell, which, on Windows, is powershell -command "<some-command>". Right now, there is no validation step to ensure the shell is available in any way, though I'd never thought this would be an issue, probably because I barely understand Powershell and Windows in general.

I'd be happy to add a preflight check that makes sure we can actually run commands at all, which is probably a good idea! @raspirin what shell do you regularly use? Right now, from the sounds of things, the CLI is hardcoded to not work for you...

from perseus.

lukechu10 avatar lukechu10 commented on May 31, 2024

What do you mean by can't find powershell? Are you running perseus serve from cmd? Normally perseus shouldn't need powershell to work.

Also what happens when you just run cargo from the same shell?

from perseus.

raspirin avatar raspirin commented on May 31, 2024

Well, I'm not familiar with Windows and Powershell either. I use Fish on Linux.
This weird issue happened when I tried to use Perseus on my friend's computer. We indeed used Powershell there, but even though we typed powershell into a Powershell instance, the shell couldn't recognize the command. This is what I mean by "Couldn't find Powershell". We added the location of powershell (C:\Windows\System32\WindowsPowerShell\v1.0) into PATH and then the cli stopped complaining about "Couldn't find cargo".
Also, cargo works just fine with that weird shell and PATH configuration.

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024

Huh, that is weird. That sounds like a configuration-specific issue somewhere in Windows, but I've just added that pre-flight check. Try downloading the latest development version of the Perseus CLI (cargo install perseus-cli --git https://github.com/framesurge/perseus) and see if that works. Without Powershell in your PATH, you should get a more descriptive error.

We could certainly try getting Perseus to work without depending on a shell, but as I said, there are historical reasons for that, because v0.1.0 had all sorts of problems on Windows that were solved by using a shell.

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024

Actually this check seems to have broken every single test, give me a moment...

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024

Okay, I've completely removed the use of shells in the CLI for now, which seems to work well, at least locally and on CI. @raspirin can you confirm this works for you on a Windows box when you next can? Happy to cut a new release if it's all working for you. (I.e. even without Powershell in your PATH, the CLI should now work fine as long as you have the necessary tools installed.)

from perseus.

raspirin avatar raspirin commented on May 31, 2024

Good news, the cli won't report "Couldn't find cargo" with and without powershell in PATH.
But I got a cli error:

Error: couldn't execute command '& 'C:\Users\rin\AppData\Local\perseus\perseus_cli\cache\tools\wasm-bindgen-0.2.88/wasm-bindgen.exe' ./dist/target_wasm/wasm32-unknown-unknown/debug/app.wasm --out-dir dist/pkg --out-name perseus_engine --target web ' (this doesn't mean it threw an error, it means it couldn't be run at all)

Caused by:
        program not found

I could manually run wasm-bindgen using the location above though.
图片

Then I added powershell into PATH and switched back to a crates.io version of cli, the same project worked just fine as on my Linux machine.

I notice that the wasm-bindgen path is weird. It's not a completely windows-style path.
Any ideas? @arctic-hen7

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024

Hmm, that command doesn't look right at all, let me see if tool execution is still depending on the shell somehow...

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 31, 2024

@raspirin I've created a new branch fix-314, could you try getting the CLI from there through cargo install? It will create a perseus_debug.log file which lists every command the CLI actually runs, my suspicion is that something is wrong with the way we split command strings into commands and arguments on Windows. Seeing that should help me understand what's going on here.

from perseus.

raspirin avatar raspirin commented on May 31, 2024

Sure. I will try this next weekend.

from perseus.

raspirin avatar raspirin commented on May 31, 2024

Sorry for the long delay. It's been a lot last couple of months.
Back to the cli problem. Somehow I can't install the patched cli from source. rustc will complain that it can't build the target. Not sure if I am doing right.

PS C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli> rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
PS C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli> cargo install --path .
  Installing perseus-cli v0.4.2 (C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli)
    Updating crates.io index
   Compiling serde v1.0.202
   Compiling thiserror v1.0.61
   Compiling tokio-util v0.7.11
   Compiling tokio-native-tls v0.3.1
   Compiling pin-project v1.1.5
   Compiling multer v2.1.0
   Compiling brotlic-sys v0.2.2
   Compiling futures-executor v0.3.30
   Compiling clap v4.5.4
   Compiling notify v5.0.0-pre.13
   Compiling tokio-stream v0.1.15
   Compiling brotlic v0.8.2
error[E0432]: unresolved import `winapi::shared::winerror`
 --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:9:21
  |
9 | use winapi::shared::winerror::ERROR_OPERATION_ABORTED;
  |                     ^^^^^^^^ could not find `winerror` in `shared`

   Compiling tungstenite v0.21.0
   Compiling futures v0.3.30
error[E0308]: mismatched types
   --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:277:29
    |
277 |         overlapped.hEvent = request_p;
    |         -----------------   ^^^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
    |         |
    |         expected due to the type of this binding
    |
    = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
   --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ffi\mod.rs:183:1
note: `winapi::ctypes::c_void` is defined in crate `winapi`
   --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
    |
38  |     pub enum c_void {}
    |     ^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\notify-5.0.0-pre.13\src\windows.rs:283:13
     |
281  |         let ret = winbase::ReadDirectoryChangesW(
     |                   ------------------------------ arguments to this function are incorrect
282  |             handle,
283  |             req_buf,
     |             ^^^^^^^ expected `winapi::ctypes::c_void`, found `libc::c_void`
     |
     = note: `libc::c_void` and `winapi::ctypes::c_void` have similar names, but are actually distinct types
note: `libc::c_void` is defined in crate `core`
    --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ffi\mod.rs:183:1
note: `winapi::ctypes::c_void` is defined in crate `winapi`
    --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\lib.rs:38:5
     |
38   |     pub enum c_void {}
     |     ^^^^^^^^^^^^^^^
note: function defined here
    --> C:\Users\rin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-0.3.9\src\um\winbase.rs:2072:12
     |
2072 |     pub fn ReadDirectoryChangesW(
     |            ^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0308, E0432.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `notify` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `perseus-cli v0.4.2 (C:\Users\rin\Downloads\perseus-fix-314\packages\perseus-cli)`, intermediate artifacts can be found at `C:\Users\rin\Downloads\perseus-fix-314\target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

from perseus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.